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 ModelCheckpoint #2396

Merged
merged 1 commit into from
Jun 23, 2021
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
10 changes: 9 additions & 1 deletion nemo/utils/exp_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class CallbackParams:
save_top_k: Optional[int] = 3
save_weights_only: Optional[bool] = False
mode: Optional[str] = "min"
period: Optional[int] = 1
period: Optional[int] = None
every_n_val_epochs: Optional[int] = 1
prefix: Optional[str] = None # If None, exp_manager will attempt to handle the filepath
postfix: str = ".nemo"
save_best_model: bool = False
Expand Down Expand Up @@ -771,6 +772,13 @@ def configure_checkpointing(trainer: 'pytorch_lightning.Trainer', log_dir: Path,
f"{trainer.check_val_every_n_epoch} epochs to ensure that checkpointing will not error out."
)

if params.period is not None:
logging.warning(
"The use of `period` in the checkpoint callback is deprecrated, please use `every_n_val_epochs` instead. "
"Overwriting `every_n_val_epochs` with `period`."
)
params.every_n_val_epochs = params.period

checkpoint_callback = NeMoModelCheckpoint(**params)
checkpoint_callback.last_model_path = trainer.resume_from_checkpoint or ""
trainer.callbacks.append(checkpoint_callback)
Expand Down