GradientNormClippingTrainingCallback

class GradientNormClippingTrainingCallback(max_norm, norm_type=None)[source]

Bases: TrainingCallback

A callback for gradient clipping before stepping the optimizer with torch.nn.utils.clip_grad_norm_().

Initialize the callback.

Parameters:

Methods Summary

pre_step(**kwargs)

Call before the optimizer's step.

Methods Documentation

pre_step(**kwargs)[source]

Call before the optimizer’s step.

Return type:

None

Parameters:

kwargs (Any) –