Clip the gradient norm of the parameters of an FSDP policy, gathering the gradients across all GPUs.
(self)
| 491 | dist.barrier() |
| 492 | |
| 493 | def clip_gradient(self): |
| 494 | """Clip the gradient norm of the parameters of an FSDP policy, gathering the gradients across all GPUs.""" |
| 495 | return self.policy.clip_grad_norm_(self.config.max_grad_norm).item() |
| 496 | |
| 497 | def save(self, output_dir=None, metrics=None): |
| 498 | """Save policy, optimizer, and scheduler state to disk, gathering from all processes and saving only on the rank 0 process.""" |
nothing calls this directly
no outgoing calls
no test coverage detected