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

Update common.py #904

Merged
merged 3 commits into from
Apr 8, 2020
Merged
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
6 changes: 2 additions & 4 deletions ignite/contrib/engines/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def setup_common_training_handlers(
device=device,
)
if dist.is_available() and dist.is_initialized():
return _setup_common_distrib_training_handlers(trainer, train_sampler=train_sampler, **kwargs)
_setup_common_distrib_training_handlers(trainer, train_sampler=train_sampler, **kwargs)
else:
if train_sampler is not None:
warnings.warn(
"Argument train_sampler distributed sampler used to call `set_epoch` method on epoch "
"started event, but no distributed setting detected",
UserWarning,
)
return _setup_common_training_handlers(trainer, **kwargs)
_setup_common_training_handlers(trainer, **kwargs)


setup_common_distrib_training_handlers = setup_common_training_handlers
Expand Down Expand Up @@ -198,8 +198,6 @@ def distrib_set_epoch(engine):
checkpoint_handler = ModelCheckpoint(dirname=output_path, filename_prefix="training")
trainer.add_event_handler(Events.ITERATION_COMPLETED(every=save_every_iters), checkpoint_handler, to_save)

return trainer


def empty_cuda_cache(_):
torch.cuda.empty_cache()
Expand Down