AssertionError: Attempted unscale_ but _scale is None. This may indicate your script did not use scaler.scale(loss or outputs) earlier in the iteration.
使用Accelerator引发的错误,在Debug时重点关注以下两处:
(1)
accelerator = Accelerator(fp16=True)
需要修改为:
accelerator = Accelerator(fp16=False)
(2)
loss.backword()
需要修改为:
accelerator.backward(loss)