Gradient clipping when using Lite #12620
Replies: 3 comments 2 replies
-
Similar question! I use lightning lite and "torch.nn.utils.clip_grad_norm_" within training for clip gradients. But it seems abnormal and usually cause "NAN" loss when adding mixed-precision training. It seems not like lightning, there is no grad scaler performed automatically. Does anyone meet these problems? @Dekakhrone Have you solved this problem? |
Beta Was this translation helpful? Give feedback.
-
the ideal way is to use
loss is scaled automatically when you do |
Beta Was this translation helpful? Give feedback.
-
similar issue, I am trying to apply gradient clipping to certain parameter groups by customizing the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everybody! As I understood from the code, it is impossible to clip gradients when using Lite without some deep modification. Am I right, or am I missing something?
Ahead of the suggestion to use the LightningModule I will say that I am writing deeply custom code that is incompatible with its limitations. However Lite is seemed to me as a solution that would take over all the work with the devices.
Beta Was this translation helpful? Give feedback.
All reactions