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

Setting of optimizer #22

Open
GCQi opened this issue Mar 25, 2024 · 0 comments
Open

Setting of optimizer #22

GCQi opened this issue Mar 25, 2024 · 0 comments

Comments

@GCQi
Copy link

GCQi commented Mar 25, 2024

hello, thank for your excellent work!
I met a n error when i run CUDA_VISIBLE_DEVICES='0,1,2,3' python -m torch.distributed.launch --nproc_per_node 4 main.py --config config/release_iccv/latr_1000_baseline.py,
the error message is:

Traceback (most recent call last):
  File "main.py", line 48, in <module>
    main()
  File "main.py", line 42, in main
    runner.train()
  File "/data/usr/LATR/experiments/runner.py", line 184, in train
    optimizer.step()
  File "/home/usr/miniconda3/envs/latr_/lib/python3.8/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper
    return wrapped(*args, **kwargs)
  File "/home/usr/miniconda3/envs/latr_/lib/python3.8/site-packages/torch/optim/optimizer.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/home/usr/miniconda3/envs/latr_/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/usr/miniconda3/envs/latr_/lib/python3.8/site-packages/torch/optim/adamw.py", line 117, in step
    beta1,
UnboundLocalError: local variable 'beta1' referenced before assignment

And then I change the config file as:

optimizer_cfg = dict(
    type='AdamW',
    lr=2e-4,
    # paramwise_cfg=dict(
    #     custom_keys={
    #         'sampling_offsets': dict(lr_mult=0.1),
    #     }),
    weight_decay=0.01)

After changing, the error disappeared.
Why does the above error occur?
Will these changes I make affect performance?
Expect the above method, what should I do to avoid the above error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant