Clip the gradient norm of the parameters of a non-FSDP policy.
(self)
| 395 | |
| 396 | |
| 397 | def clip_gradient(self): |
| 398 | """Clip the gradient norm of the parameters of a non-FSDP policy.""" |
| 399 | return torch.nn.utils.clip_grad_norm_(self.policy.parameters(), self.config.max_grad_norm).item() |
| 400 | |
| 401 | def write_state_dict(self, step: int, state: Dict[str, torch.Tensor], metrics: Dict, filename: str, dir_name: Optional[str] = None): |
| 402 | """Write a checkpoint to disk.""" |