Skip to content

Commit 4d27208

Browse files
author
Z User
committed
fix(training): scaler.unscale_() called after step() on optim_d
scaler.update() was only called after optim_g.step(), which resets the scaler's internal state. On the next iteration, optim_d tried to call scaler.unscale_() on an already-updated scaler -> crash. Fix: add scaler.update() right after scaler.step(optim_d) so each optimizer properly completes its own scaler cycle before the other one runs.
1 parent d29cb66 commit 4d27208

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • advanced_rvc_inference/engine/training/runner

advanced_rvc_inference/engine/training/runner/train.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ def train_and_evaluate(rank, epoch, hps, nets, optims, scaler, train_loader, wri
762762
scaler.unscale_(optim_d)
763763
grad_norm_d = commons.clip_grad_value(net_d.parameters(), None)
764764
scaler.step(optim_d)
765+
scaler.update()
765766
else:
766767
loss_disc.backward()
767768
grad_norm_d = commons.clip_grad_value(net_d.parameters(), None)

0 commit comments

Comments
 (0)