docs(trainer): fix gradient clipping entry (#85)

- replace copy and paste error
- write brief description
- add link to pytorch docs for specific clipping implementation
- add example configuration
This commit is contained in:
Rich Lewis
2019-08-09 15:02:14 -04:00
committed by William Falcon
parent 018b8da50e
commit dd0db4aba2
+7 -4
View File
@@ -28,15 +28,18 @@ trainer = Trainer(enable_early_stop=True)
```
---
#### Gradient Clipping
Use this to turn off early stopping and run training to the [max_epoch](#force-training-for-min-or-max-epochs)
#### Gradient Clipping
Gradient clipping may be enabled to avoid exploding gradients.
Specifically, this will [clip the gradient norm computed over all model parameters *together*](https://pytorch.org/docs/stable/nn.html#torch.nn.utils.clip_grad_norm_).
``` {.python}
# DEFAULT (ie: don't clip)
trainer = Trainer(gradient_clip=0)
# clip gradients with norm above 0.5
trainer = Trainer(gradient_clip=0.5)
```
---
#### Inspect gradient norms
Looking at grad norms can help you figure out where training might be going wrong.