removed checkpoint save_function option

This commit is contained in:
William Falcon 2019-06-28 17:14:18 -04:00
parent fd28d38693
commit 63d84283a4
3 changed files with 21 additions and 6 deletions

View File

@ -0,0 +1,18 @@
Lightning can automate saving and loading checkpoints.
---
### Model saving
To enable checkpointing, define the checkpoint callback
``` {.python}
from pytorch_lightning.utils.pt_callbacks import ModelCheckpoint
checkpoint = ModelCheckpoint(
filepath='/path/to/store/weights.ckpt',
save_function=None,
save_best_only=not hparams.keep_all_checkpoints,
verbose=True,
monitor=hparams.model_save_monitor_value,
mode=hparams.model_save_monitor_mode
)
```

View File

@ -24,10 +24,8 @@ But of course the fun is in all the advanced things it can do:
**Computing cluster (SLURM)**
- Automatic checkpointing
- Automatic saving, loading
- Running grid search on a cluster
- Walltime auto-resubmit
- [Running grid search on a cluster](SLURM%20Managed%20Cluster/#running-grid-search-on-a-cluster)
- [Walltime auto-resubmit](SLURM%20Managed%20Cluster/#walltime-auto-resubmit)
**Debugging**

View File

@ -170,12 +170,11 @@ class ModelCheckpoint(Callback):
period: Interval (number of epochs) between checkpoints.
"""
def __init__(self, filepath, save_function, monitor='val_loss', verbose=0,
def __init__(self, filepath, monitor='val_loss', verbose=0,
save_best_only=False, save_weights_only=False,
mode='auto', period=1, prefix=''):
super(ModelCheckpoint, self).__init__()
self.monitor = monitor
self.save_function = save_function
self.verbose = verbose
self.filepath = filepath
self.save_best_only = save_best_only