prog bar option

This commit is contained in:
William Falcon
2019-06-27 11:22:13 -04:00
parent 4f75515ca4
commit b1fdde5daf
4 changed files with 43 additions and 43 deletions
+34
View File
@@ -0,0 +1,34 @@
The asdf
---
#### Accumulated gradients
Accumulated gradients runs K small batches of size N before doing a backwards pass. The effect is a large effective batch size of size KxN.
``` {.python}
# default 1 (ie: no accumulated grads)
trainer = Trainer(accumulate_grad_batches=1)
```
---
#### Check GPU usage
Lightning automatically logs gpu usage to the test tube logs. It'll only do it at the metric logging interval, so it doesn't slow down training.
---
#### Check which gradients are nan
This option prints a list of tensors with nan gradients.
``` {.python}
trainer = Trainer(check_grad_nans=False)
```
---
#### Check validation every n epochs
If you have a small dataset you might want to check validation every n epochs
``` {.python}
trainer = Trainer(check_val_every_n_epoch=1)
```
---
#### Display metrics in progress bar
``` {.python}
trainer = Trainer(progress_bar=True)
```
+1 -35
View File
@@ -16,41 +16,6 @@ trainer.fit(model)
But of course the fun is in all the advanced things it can do:
``` {.python}
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
from test_tube import Experiment, SlurmCluster
trainer = Trainer(
experiment=Experiment,
checkpoint_callback=ModelCheckpoint,
early_stop_callback=EarlyStopping,
cluster=SlurmCluster,
process_position=0,
current_gpu_name=0,
gpus=None,
enable_tqdm=True,
overfit_pct=0.0,
track_grad_norm=-1,
check_val_every_n_epoch=1,
fast_dev_run=False,
accumulate_grad_batches=1,
enable_early_stop=True, max_nb_epochs=5, min_nb_epochs=1,
train_percent_check=1.0,
val_percent_check=1.0,
test_percent_check=1.0,
val_check_interval=0.95,
log_save_interval=1, add_log_row_interval=1,
lr_scheduler_milestones=None,
use_amp=False,
check_grad_nans=False,
amp_level='O2',
nb_sanity_val_steps=5):
)
```
Things you can do with the trainer module:
**Training loop**
- Accumulate gradients
@@ -58,6 +23,7 @@ Things you can do with the trainer module:
- Check which gradients are nan
- Check validation every n epochs
- Display metrics in progress bar
- Display the parameter count by layer
- Force training for min or max epochs
- Inspect gradient norms
- Learning rate annealing