Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow imagenet training profiling to be disabled in config #4043

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/imagenet/configs/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def get_config():
# num_epochs using the entire dataset. Similarly for steps_per_eval.
config.num_train_steps = -1
config.steps_per_eval = -1

# whether to profile the training loop
config.profile = True

return config


Expand Down
4 changes: 2 additions & 2 deletions examples/imagenet/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def train_and_evaluate(

train_metrics = []
hooks = []
if jax.process_index() == 0:
hooks += [periodic_actions.Profile(num_profile_steps=5, logdir=workdir)]
if jax.process_index() == 0 and config.profile:
hooks += [periodic_actions.Profile(num_profile_steps=3, logdir=workdir)]
train_metrics_last_t = time.time()
logging.info('Initial compilation, this might take some minutes...')
for step, batch in zip(range(step_offset, num_steps), train_iter):
Expand Down
Loading