File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/lightning/pytorch/plugins/precision Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,18 @@ def optimizer_step( # type: ignore[override]
101
101
@override
102
102
def clip_gradients (
103
103
self ,
104
- module : Optional [Module ],
105
104
optimizer : Optimizer ,
106
105
clip_val : Union [int , float ] = 0.0 ,
107
106
gradient_clip_algorithm : GradClipAlgorithmType = GradClipAlgorithmType .NORM ,
107
+ module : Optional [Module ] = None ,
108
108
) -> None :
109
109
if clip_val > 0 and _optimizer_handles_unscaling (optimizer ):
110
110
raise RuntimeError (
111
111
f"The current optimizer, { type (optimizer ).__qualname__ } , does not allow for gradient clipping"
112
112
" because it performs unscaling of gradients internally. HINT: Are you using a 'fused' optimizer?"
113
113
)
114
114
super ().clip_gradients (
115
- module = module , optimizer = optimizer , clip_val = clip_val , gradient_clip_algorithm = gradient_clip_algorithm
115
+ optimizer = optimizer , clip_val = clip_val , gradient_clip_algorithm = gradient_clip_algorithm , module = module
116
116
)
117
117
118
118
def autocast_context_manager (self ) -> torch .autocast :
You can’t perform that action at this time.
0 commit comments