hy, when i start training they showing the following error.
trainer.train()
here is the error
RuntimeError: unscale_() has already been called on this optimizer since the last update().
Step | Training Loss |
---|
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ in <cell line: 1>:1 โ โ โ โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:1645 in train โ โ โ โ 1642 โ โ inner_training_loop = find_executable_batch_size( โ โ 1643 โ โ โ self._inner_training_loop, self._train_batch_size, args.auto_find_batch_size โ โ 1644 โ โ ) โ โ โฑ 1645 โ โ return inner_training_loop( โ โ 1646 โ โ โ args=args, โ โ 1647 โ โ โ resume_from_checkpoint=resume_from_checkpoint, โ โ 1648 โ โ โ trial=trial, โ โ โ โ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:1987 in _inner_training_loop โ โ โ โ 1984 โ โ โ โ โ โ โ โ args.max_grad_norm, โ โ 1985 โ โ โ โ โ โ โ ) โ โ 1986 โ โ โ โ โ โ else: โ โ โฑ 1987 โ โ โ โ โ โ โ self.accelerator.clip_grad_norm_( โ โ 1988 โ โ โ โ โ โ โ โ model.parameters(), โ โ 1989 โ โ โ โ โ โ โ โ args.max_grad_norm, โ โ 1990 โ โ โ โ โ โ โ ) โ โ โ โ /usr/local/lib/python3.10/dist-packages/accelerate/accelerator.py:1893 in clip_grad_norm_ โ โ โ โ 1890 โ โ โ # `accelerator.backward(loss)` is doing that automatically. Therefore, its i โ โ 1891 โ โ โ # We cannot return the gradient norm because DeepSpeed does it. โ โ 1892 โ โ โ return None โ โ โฑ 1893 โ โ self.unscale_gradients() โ โ 1894 โ โ return torch.nn.utils.clip_grad_norm_(parameters, max_norm, norm_type=norm_type) โ โ 1895 โ โ โ 1896 โ def clip_grad_value_(self, parameters, clip_value): โ โ โ โ /usr/local/lib/python3.10/dist-packages/accelerate/accelerator.py:1856 in unscale_gradients โ โ โ โ 1853 โ โ โ for opt in optimizer: โ โ 1854 โ โ โ โ while isinstance(opt, AcceleratedOptimizer): โ โ 1855 โ โ โ โ โ opt = opt.optimizer โ โ โฑ 1856 โ โ โ โ self.scaler.unscale_(opt) โ โ 1857 โ โ โ 1858 โ def clip_grad_norm_(self, parameters, max_norm, norm_type=2): โ โ 1859 โ โ """ โ โ โ โ /usr/local/lib/python3.10/dist-packages/torch/cuda/amp/grad_scaler.py:275 in unscale_ โ โ โ โ 272 โ โ optimizer_state = self._per_optimizer_states[id(optimizer)] โ โ 273 โ โ โ โ 274 โ โ if optimizer_state["stage"] is OptState.UNSCALED: โ โ โฑ 275 โ โ โ raise RuntimeError("unscale_() has already been called on this optimizer sin โ โ 276 โ โ elif optimizer_state["stage"] is OptState.STEPPED: โ โ 277 โ โ โ raise RuntimeError("unscale_() is being called after step().") โ โ 278 โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ RuntimeError: unscale_() has already been called on this optimizer since the last update().