move schedule.step after optimizer.step

This commit is contained in:
erenup committed 2019-09-18 21:13:40 +08:00
1 parent 84b9d1c423
commit 36362cf086
1 file changed
+2 -1
@@ -158,8 +158,9 @@ def train(args, train_dataset, model, tokenizer):
tr_loss += loss.item()
if (step + 1) % args.gradient_accumulation_steps == 0:
scheduler.step() # Update learning rate schedule
optimizer.step()
scheduler.step() # Update learning rate schedule
model.zero_grad()
global_step += 1