Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lr scheduler warning in segmentation template #165

Open
ydcjeff opened this issue Jul 9, 2021 · 0 comments
Open

fix lr scheduler warning in segmentation template #165

ydcjeff opened this issue Jul 9, 2021 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest Hacktoberfest templates

Comments

@ydcjeff
Copy link
Member

ydcjeff commented Jul 9, 2021

Describe the bug

Following warning is shown in the CI: step-504

/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/torch/optim/lr_scheduler.py:134:

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

Reproduction

https://github.com/pytorch-ignite/code-generator/tree/main/src/templates/template-vision-segmentation

Steps to reproduce

python main.py \
  --data_path <path_to_dataset> \
  --train_batch_size 4 \
  --eval_batch_size 4 \
  --num_workers 2 \
  --max_epochs 2 \
  --train_epoch_length 4 \
  --eval_epoch_length 4

Expected result

No warning to show.

Environment info

Output of python -m torch.utils.collect_env:

OS: Linux
torch: 1.9.0
torchvision: 0.10.0
ignite: 0.4.5

If you like to tackle this issue, please comment that you want to work on and see the contributing guide.

@ydcjeff ydcjeff added bug Something isn't working good first issue Good for newcomers templates labels Jul 9, 2021
@vfdev-5 vfdev-5 added the hacktoberfest Hacktoberfest label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hacktoberfest Hacktoberfest templates
Projects
None yet
Development

No branches or pull requests

2 participants