Skip to content

CheckpointSaver: incorrect labelling of final model #1338

Description

@cemde

Describe the bug
When using a CheckpointSaver among the validation handlers, the argument save_final=True results in every epoch being stored under net_final_iteration=1.pt when final_filename=None. I interpret the docs (default to checkpoint_final_iteration=N.pt) that the file will be renamed after each completed epoch.

To Reproduce
add save_final=True to the CheckpointHandler in the Lung Segmentation Tutorial

Expected behavior
net_final_iteration=1.pt -> net_final_iteration=2.pt -> ... -> net_final_iteration=MAX_EPOCHS.pt

Screenshots
The logging function also prints incorrect iteration numbers:

INFO:ignite.engine.engine.SupervisedEvaluator:Train completed, saved final checkpoint: net_final_iteration=1.pt
...
INFO:ignite.engine.engine.SupervisedEvaluator:Train completed, saved final checkpoint: net_final_iteration=1.pt
...
INFO:ignite.engine.engine.SupervisedEvaluator:Train completed, saved final checkpoint: net_final_iteration=1.pt

Environment

Ensuring you use the relevant python executable, please paste the output of:

MONAI version: 0.3.0+95.g535561e
Python version: 3.8.6 | packaged by conda-forge | (default, Oct  7 2020, 18:42:56)  [Clang 10.0.1 ]
OS version: Darwin (19.6.0)
Numpy version: 1.19.2
Pytorch version: 1.7.0
MONAI flags: HAS_EXT = False, USE_COMPILED = False

Optional dependencies:
Pytorch Ignite version: 0.4.2
Nibabel version: 3.2.0
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
Pillow version: 8.0.1
Tensorboard version: 2.4.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.8.1
ITK version: NOT INSTALLED or UNKNOWN VERSION.
tqdm version: 4.53.0
lmdb version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies

Additional context
Using SupervisedEvaluator and SupervisedTrainer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions