Merge pull request #1136 from adai183/update_SQuAD_script

swap order of optimizer.step() and scheduler.step()
This commit is contained in:
Thomas Wolf 2019-08-28 22:00:52 +02:00 committed by GitHub
commit d9847678b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,8 +157,8 @@ 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