docs: `fabric_methods.rst` using deprecated parameters (#18015)

This commit is contained in:
Minh-Long Luu (刘明龙) 2023-07-07 16:32:09 +07:00 committed by GitHub
parent bb4751729e
commit c8656f1a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -98,14 +98,14 @@ This is useful if your model experiences *exploding gradients* during training.
fabric.clip_gradients(model, optimizer, clip_val=0.5)
# Clip gradients such that their total norm is no bigger than 2.0
fabric.clip_gradients(model, optimizer, clip_norm=2.0)
fabric.clip_gradients(model, optimizer, max_norm=2.0)
# By default, clipping by norm uses the 2-norm
fabric.clip_gradients(model, optimizer, clip_norm=2.0, norm_type=2)
fabric.clip_gradients(model, optimizer, max_norm=2.0, norm_type=2)
# You can also choose the infinity-norm, which clips the largest
# element among all
fabric.clip_gradients(model, optimizer, clip_norm=2.0, norm_type="inf")
fabric.clip_gradients(model, optimizer, max_norm=2.0, norm_type="inf")
The :meth:`~lightning.fabric.fabric.Fabric.clip_gradients` method is agnostic to the precision and strategy being used.
Note: Gradient clipping with FSDP is not yet fully supported.