From e327e0ce27360e39cc271f4e41727976dd101c33 Mon Sep 17 00:00:00 2001 From: Jaime Ferrando Huertas Date: Tue, 6 Jul 2021 16:01:10 +0200 Subject: [PATCH 1/5] auto metric name doc fix Added auto_insert_metric_name in modelcheckpoint docstring --- pytorch_lightning/callbacks/model_checkpoint.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index eae401067b25f..40b572e7bd075 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -98,6 +98,10 @@ class ModelCheckpoint(Callback): If ``save_top_k != 0``, the decision to overwrite the current save file is made based on either the maximization or the minimization of the monitored quantity. For ``'val_acc'``, this should be ``'max'``, for ``'val_loss'`` this should be ``'min'``, etc. + auto_insert_metric_name: When ``True`` checkpoints filename will contain the metric name. + For filename ``filename='checkpoint_{epoch:02d}-{acc:02d}`` epoch 1 and acc 80 it will resolve to + ``checkpoint_epoch=01-val=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` + as this will result in extra folders. Default: ``True``. save_weights_only: if ``True``, then only the model's weights will be saved (``model.save_weights(filepath)``), else the full model is saved (``model.save(filepath)``). From ed5b47503a7d2b27c9fdac0da17ea8787362c634 Mon Sep 17 00:00:00 2001 From: Jaime Ferrando Huertas Date: Tue, 6 Jul 2021 18:39:39 +0200 Subject: [PATCH 2/5] Update pytorch_lightning/callbacks/model_checkpoint.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Mocholí --- pytorch_lightning/callbacks/model_checkpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index 40b572e7bd075..36be31bd913ef 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -100,7 +100,7 @@ class ModelCheckpoint(Callback): For ``'val_acc'``, this should be ``'max'``, for ``'val_loss'`` this should be ``'min'``, etc. auto_insert_metric_name: When ``True`` checkpoints filename will contain the metric name. For filename ``filename='checkpoint_{epoch:02d}-{acc:02d}`` epoch 1 and acc 80 it will resolve to - ``checkpoint_epoch=01-val=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` + ``checkpoint_epoch=01-acc=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` as this will result in extra folders. Default: ``True``. save_weights_only: if ``True``, then only the model's weights will be saved (``model.save_weights(filepath)``), else the full model From 36ab49dfc1553aa35a518a37ad1deb0ef59d08bf Mon Sep 17 00:00:00 2001 From: Jaime Ferrando Huertas Date: Tue, 6 Jul 2021 18:39:50 +0200 Subject: [PATCH 3/5] Update pytorch_lightning/callbacks/model_checkpoint.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Mocholí --- pytorch_lightning/callbacks/model_checkpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index 36be31bd913ef..7c9f5b8a87dd0 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -99,7 +99,7 @@ class ModelCheckpoint(Callback): based on either the maximization or the minimization of the monitored quantity. For ``'val_acc'``, this should be ``'max'``, for ``'val_loss'`` this should be ``'min'``, etc. auto_insert_metric_name: When ``True`` checkpoints filename will contain the metric name. - For filename ``filename='checkpoint_{epoch:02d}-{acc:02d}`` epoch 1 and acc 80 it will resolve to + For example, ``filename='checkpoint_{epoch:02d}-{acc:02d}`` with epoch 1 and acc 80 will resolve to ``checkpoint_epoch=01-acc=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` as this will result in extra folders. Default: ``True``. save_weights_only: if ``True``, then only the model's weights will be From 057215a433e2c640f069b1ed42fe42b2ce3dca88 Mon Sep 17 00:00:00 2001 From: Jaime Ferrando Huertas Date: Tue, 6 Jul 2021 18:39:55 +0200 Subject: [PATCH 4/5] Update pytorch_lightning/callbacks/model_checkpoint.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Mocholí --- pytorch_lightning/callbacks/model_checkpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index 7c9f5b8a87dd0..5d2baa7355772 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -98,7 +98,7 @@ class ModelCheckpoint(Callback): If ``save_top_k != 0``, the decision to overwrite the current save file is made based on either the maximization or the minimization of the monitored quantity. For ``'val_acc'``, this should be ``'max'``, for ``'val_loss'`` this should be ``'min'``, etc. - auto_insert_metric_name: When ``True`` checkpoints filename will contain the metric name. + auto_insert_metric_name: When ``True``, the checkpoints filenames will contain the metric name. For example, ``filename='checkpoint_{epoch:02d}-{acc:02d}`` with epoch 1 and acc 80 will resolve to ``checkpoint_epoch=01-acc=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` as this will result in extra folders. Default: ``True``. From fda94531933b58e59e6c9a4b05959d1eed49ecd3 Mon Sep 17 00:00:00 2001 From: Jaime Ferrando Huertas Date: Tue, 6 Jul 2021 18:40:12 +0200 Subject: [PATCH 5/5] Update pytorch_lightning/callbacks/model_checkpoint.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Mocholí --- pytorch_lightning/callbacks/model_checkpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/callbacks/model_checkpoint.py b/pytorch_lightning/callbacks/model_checkpoint.py index 5d2baa7355772..5d6f5ad1f7d33 100644 --- a/pytorch_lightning/callbacks/model_checkpoint.py +++ b/pytorch_lightning/callbacks/model_checkpoint.py @@ -101,7 +101,7 @@ class ModelCheckpoint(Callback): auto_insert_metric_name: When ``True``, the checkpoints filenames will contain the metric name. For example, ``filename='checkpoint_{epoch:02d}-{acc:02d}`` with epoch 1 and acc 80 will resolve to ``checkpoint_epoch=01-acc=80.ckp``. Is useful to set it to ``False`` when metric names contain ``/`` - as this will result in extra folders. Default: ``True``. + as this will result in extra folders. save_weights_only: if ``True``, then only the model's weights will be saved (``model.save_weights(filepath)``), else the full model is saved (``model.save(filepath)``).