mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
Fix error of 'Runner' object has no attribute 'log_buffer' (#259)
* fix 'Runner' object has no attribute 'log_buffer' * update * add train
This commit is contained in:
parent
4705e1fe3d
commit
08a3adb5d7
@ -92,8 +92,8 @@ class OptimizerHook(Hook):
|
|||||||
grad_norm = self.clip_grads(runner.model.parameters())
|
grad_norm = self.clip_grads(runner.model.parameters())
|
||||||
if grad_norm is not None:
|
if grad_norm is not None:
|
||||||
# Add grad norm to the logger
|
# Add grad norm to the logger
|
||||||
runner.log_buffer.update({'grad_norm': float(grad_norm)},
|
runner.message_hub.update_scalar('train/grad_norm',
|
||||||
runner.outputs['num_samples'])
|
float(grad_norm))
|
||||||
runner.optimizer.step()
|
runner.optimizer.step()
|
||||||
|
|
||||||
def detect_anomalous_parameters(self, loss: torch.Tensor, runner) -> None:
|
def detect_anomalous_parameters(self, loss: torch.Tensor, runner) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user