generated from ashleve/lightning-hydra-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix last and best checkpoints issue (#160)
- Loading branch information
1 parent
db92cd5
commit 0e43ba5
Showing
3 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# https://pytorch-lightning.readthedocs.io/en/latest/api/lightning.callbacks.ModelCheckpoint.html | ||
|
||
# Save the model periodically by monitoring a quantity. | ||
# Look at the above link for more detailed information. | ||
latest_checkpoint: | ||
_target_: lightning.pytorch.callbacks.ModelCheckpoint | ||
dirpath: null # directory to save the model file | ||
filename: "latest_epoch_{epoch:03d}" # checkpoint filename | ||
monitor: "epoch" # name of the logged metric which determines when model is improving | ||
verbose: False # verbosity mode | ||
save_last: True # additionally always save an exact copy of the last checkpoint to a file last.ckpt | ||
save_top_k: 1 # save k best models (determined by above metric) | ||
mode: "max" # "max" means higher metric value is better, can be also "min" | ||
auto_insert_metric_name: False # when True, the checkpoints filenames will contain the metric name | ||
save_weights_only: False # if True, then only the model’s weights will be saved | ||
every_n_train_steps: null # number of training steps between checkpoints | ||
train_time_interval: null # checkpoints are monitored at the specified time interval | ||
every_n_epochs: 50 # number of epochs between checkpoints | ||
save_on_train_epoch_end: null # whether to run checkpointing at the end of the training epoch or the end of validation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
defaults: | ||
- model_checkpoint | ||
- latest_checkpoint | ||
- model_summary | ||
- rich_progress_bar | ||
- learning_rate_monitor | ||
- _self_ | ||
|
||
model_checkpoint: | ||
dirpath: ${paths.output_dir}/checkpoints | ||
filename: "epoch_{epoch:03d}" | ||
filename: "best_epoch_{epoch:03d}" | ||
monitor: "val/dice_MA" | ||
mode: "max" | ||
save_last: True | ||
auto_insert_metric_name: False | ||
|
||
latest_checkpoint: | ||
dirpath: ${paths.output_dir}/checkpoints | ||
|
||
model_summary: | ||
max_depth: -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters