facebookresearch / ParlAI

A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
https://parl.ai
MIT License
10.48k stars 2.1k forks source link

lr_scheduler.step() is being called before optimizer.step() #2042

Closed hadasah closed 4 years ago

hadasah commented 5 years ago

When using train_model.py, I get this error:

/private/home/margaretli/.conda/envs/latest/lib/python3.7/site-packages/torch/optim/lr_scheduler.py:82: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule.See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate

domrigoglioso commented 4 years ago

@hadasah Would you be able to provide a specific command that causes the warning to show?

stephenroller commented 4 years ago

pretty much if you provide --lr-scheduler invsqrt to any of the models

hadasah commented 4 years ago

^^ what stephen said. But if you need a specific invocation to get started:

python examples/train_model.py -t convai2 -m transformer/ranker -mf /tmp/tr0 --lr_scheduler invsqrt --warmup_updates 50