Update Docs for current checkpointing behaviour (#445)

Related issue #432

The old documentation suggested that the way to restore a training session is to use a test_tube Experiment. Trainer no longer takes an experiment as a parameter, so it seems the current way to restore a training session is to pass an experiment via a TestTubeLogger. Even if this is not the most elegant solution, updating the docs will at least point new users in the right direction.
This commit is contained in:
Joel Wong 2019-10-31 21:40:32 +11:00 committed by William Falcon
parent f79bdf2327
commit f6b8b175bb
1 changed files with 11 additions and 4 deletions

View File

@ -32,12 +32,19 @@ You might want to not only load a model but also continue training it. Use this
restore the trainer state as well. This will continue from the epoch and global step you last left off.
However, the dataloaders will start from the first batch again (if you shuffled it shouldn't matter).
Lightning will restore the session if you pass an experiment with the same version and there's a saved checkpoint.
Lightning will restore the session if you pass a logger with the same version and there's a saved checkpoint.
``` {.python}
from test_tube import Experiment
from pytorch_lightning import Trainer
from pytorch_lightning.logging import TestTubeLogger
exp = Experiment(version=a_previous_version_with_a_saved_checkpoint)
trainer = Trainer(experiment=exp)
logger = TestTubeLogger(
save_dir='./savepath',
version=1 # An existing version with a saved checkpoint
)
trainer = Trainer(
logger=logger,
default_save_path='./savepath'
)
# this fit call loads model weights and trainer state
# the trainer continues seamlessly from where you left off