mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-11 12:31:23 +08:00
* early stopping callback is not default * added a default logger * added default checkpoint callback * added default checkpoint/loggers * added default checkpoint/loggers * updated docs * cleaned demos * cleaned demos * cleaned demos * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers * clean up docs around loggers
This commit is contained in:
@@ -2,13 +2,20 @@ Lightning can automate saving and loading checkpoints.
|
||||
|
||||
---
|
||||
### Model saving
|
||||
To enable checkpointing, define the checkpoint callback and give it to the trainer.
|
||||
Checkpointing is enabled by default to the current working directory.
|
||||
To change the checkpoint path pass in :
|
||||
```python
|
||||
Trainer(default_save_path='/your/path/to/save/checkpoints')
|
||||
```
|
||||
|
||||
To modify the behavior of checkpointing pass in your own callback.
|
||||
|
||||
``` {.python}
|
||||
from pytorch_lightning.callbacks import ModelCheckpoint
|
||||
|
||||
# DEFAULTS used by the Trainer
|
||||
checkpoint_callback = ModelCheckpoint(
|
||||
filepath='/path/to/store/weights/',
|
||||
filepath=os.getcwd(),
|
||||
save_best_only=True,
|
||||
verbose=True,
|
||||
monitor='val_loss',
|
||||
|
||||
+19
-2
@@ -1,16 +1,33 @@
|
||||
Lighting offers options for logging information about model, gpu usage, etc, via several different logging frameworks. It also offers printing options for training monitoring.
|
||||
|
||||
---
|
||||
### default_save_path
|
||||
Lightning sets a default TestTubeLogger and CheckpointCallback for you which log to
|
||||
```os.getcwd()``` by default. To modify the logging path you can set:
|
||||
```python
|
||||
Trainer(default_save_path='/your/path/to/save/checkpoints')
|
||||
```
|
||||
|
||||
If you need more custom behavior (different paths for both, different metrics, etc...)
|
||||
from the logger and the checkpointCallback, pass in your own instances as explained below.
|
||||
|
||||
|
||||
---
|
||||
### Setting up logging
|
||||
|
||||
Initialize your logger, which should inherit from `LightningBaseLogger`, and pass
|
||||
it to `Trainer`.
|
||||
The trainer inits a default logger for you (TestTubeLogger). All logs will
|
||||
go to the current working directory under a folder named ```os.getcwd()/lightning_logs``.
|
||||
|
||||
If you want to modify the default logging behavior even more, pass in a logger
|
||||
(which should inherit from `LightningBaseLogger`).
|
||||
|
||||
```{.python}
|
||||
my_logger = MyLightningLogger(...)
|
||||
trainer = Trainer(logger=my_logger)
|
||||
```
|
||||
|
||||
The path in this logger will overwrite default_save_path.
|
||||
|
||||
Lightning supports several common experiment tracking frameworks out of the box
|
||||
|
||||
---
|
||||
|
||||
@@ -21,17 +21,18 @@ trainer = Trainer(min_nb_epochs=1, max_nb_epochs=1000)
|
||||
|
||||
---
|
||||
#### Early stopping
|
||||
To enable early-stopping, define the callback and give it to the trainer.
|
||||
The trainer already sets up default early stopping for you.
|
||||
To modify this behavior, pass in your own EarlyStopping callback.
|
||||
``` {.python}
|
||||
from pytorch_lightning.callbacks import EarlyStopping
|
||||
|
||||
# DEFAULTS
|
||||
# DEFAULTS used by Trainer
|
||||
early_stop_callback = EarlyStopping(
|
||||
monitor='val_loss',
|
||||
min_delta=0.00,
|
||||
patience=0,
|
||||
patience=3,
|
||||
verbose=False,
|
||||
mode='auto'
|
||||
mode='min'
|
||||
)
|
||||
|
||||
trainer = Trainer(early_stop_callback=early_stop_callback)
|
||||
|
||||
Reference in New Issue
Block a user