We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 062ca27 + 8be781e commit 73cd554Copy full SHA for 73cd554
batchflow/models/torch/base.py
@@ -815,8 +815,9 @@ def setup_gradient_clipping(self):
815
raise ValueError(f'gradient_clipping must be int, float or callable but it is{type(gradient_clipping)}')
816
817
for p in self.model.parameters():
818
- hook = p.register_hook(function)
819
- self._hooks.append(hook)
+ if p.requires_grad:
+ hook = p.register_hook(function)
820
+ self._hooks.append(hook)
821
822
def setup_weights_averaging(self):
823
""" Prepare WA-model: check all required keys and store copy on CPU. """
0 commit comments