ModelCheckpoint — PyTorch Lightning 2.4.0 documentation
Save the model periodically by monitoring a quantity. Every metric logged with log() or log_dict() is a candidate for the monitor key. For more information, see Checkpointing. After training finishes, use best_model_path to retrieve the path to the best checkpoint file and best_model_score to retrieve its score. dirpath (Union[str, Path, None]) – directory to save the model file. Example: By default, dirpath is None and will be set at runtime to the location specified by Trainer’s default_root_dir argument, and if the Trainer uses a logger, the path will also contain logger name and version. filename (Optional[str]) – checkpoint filename. Can contain named formatting options to be auto-filled. Example: By default, filename is None and will be set to '{epoch}-{step}', where “epoch” and “step” match the number of finished epoch and optimizer steps respectively. monitor (Optional[str]) – quantity to monitor. By default it is None which saves a checkpoint only for the last epoch. verbos
ModelCheckpoint ¶ class lightning.pytorch.callbacks. ModelCheckpoint ( dirpath = None , filename = None , monitor = None , verbose = False , save_last = None , save_top_k = 1 , save_on_exception = False , save_weights_only = False , mode = 'min' , auto_insert_metric_name = True , every_n_train_steps = None , train_time_interval = None , every_n_epochs = None , save_on_train_epoch_end = None , enable_version_counter = True ) [source] ¶ Bases: Checkpoint Save the model after every epoch by monitoring a quantity. Every logged metrics are passed to the Logger for the version it gets saved in the s
Explore this link on the map →related reading
- Customize checkpointing behavior (intermediate) - PyTorch Lightning 2.6.1 documentationlightning.ai
- Saving and loading checkpoints (basic) - PyTorch Lightning 2.6.1 documentationlightning.ai
- Trainer - PyTorch Lightning 2.6.1 documentationlightning.ai
- LightningModule - PyTorch Lightning 2.6.1 documentationlightning.ai
- Current and New Activation Checkpointing Techniques in PyTorch – PyTorchpytorch.org
- API Reference — TensorRT LLMnvidia.github.io
- Get Started with Distributed Training using PyTorch Lightning — Ray 2.56.0docs.ray.io
- Composer2.pdfcursor.com
- ⏯️ Autoresume Training - Composerdocs.mosaicml.com
- Fine-tuning a model with the Trainer API · Hugging Facehuggingface.co
- GitHub - google-research/tuning_playbook: A playbook for systematically maximizing the performance of deep learning models. · GitHubgithub.com
- Efficient LLM Finetuning with Unsloth | Modal Docsmodal.com