-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
π Feature
Option for ModelCheckpoint callback to override a .ckpt file if one of the same filename already exists, instead of modifying the name and storing both ckpt. This could be something like a new param in the ModelCheckpoint callback override_existing=False.
Motivation
Currently if i provide a filename that already exists, the callback automatically appends a -v1 to the name. For cases when we rely on naming conventions for ckpt files, and we try to enforce those names by passing a specific name to ModelCheckpoint.filename
, we'd like the .ckpt to have that exact name, not some modified version of it
Pitch
I propose a new parameter in the ModelCheckpoint callback that by default could match current behavior, but give the option to override any existing ckpt file of the same name if it already exists. This could be override_existing=False
on the ModelCheckpoint constructor.
Alternatives
- current solution which appends a suffix to name breaks pipelines that do stuff with the ckpt afterwards and rely on the name matching what was provided to Modelcheckpoint.filename parameter.
- Making my proposal the default behavior instead of an option: considered this but would be less impactful to keep it as an option that, if left untriggered, maintains current behavior.
If you enjoy Lightning, check out our other projects! β‘
-
Metrics: Machine learning metrics for distributed, scalable PyTorch applications.
-
Lite: enables pure PyTorch users to scale their existing code on any kind of device while retaining full control over their own loops and optimization logic.
-
Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, fine-tuning, and solving problems with deep learning.
-
Bolts: Pretrained SOTA Deep Learning models, callbacks, and more for research and production with PyTorch Lightning and PyTorch.
-
Lightning Transformers: Flexible interface for high-performance research using SOTA Transformers leveraging PyTorch Lightning, Transformers, and Hydra.