question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: add(): argument 'alpha' must be Number, not NoneType #35

See original GitHub issue

I was trying to run the repo DynamicHead and trying to run the model with a custom dataset and have the following error. In the repo the launch function is called and I get these errors.

The command I run was

DETECTRON2_DATASETS=$DATASET python train_net.py --config configs/dyhead_r50_retina_fpn_1x.yaml --num-gpus 8

Logs

Traceback (most recent call last):
  File "train_net_custom.py", line 222, in <module>
    launch(
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch
    main_func(*args)
  File "train_net_custom.py", line 216, in main
    return trainer.train()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 484, in train
    super().train(self.start_iter, self.max_iter)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 149, in train
    self.run_step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 494, in run_step
    self._trainer.run_step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 294, in run_step
    self.optimizer.step()
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/lr_scheduler.py", line 65, in wrapper
    return wrapped(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/optimizer.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/sgd.py", line 110, in step
    F.sgd(params_with_grad,
  File "/home/xxx/anaconda3/envs/detectron/lib/python3.8/site-packages/torch/optim/_functional.py", line 160, in sgd
    d_p = d_p.add(param, alpha=weight_decay)
TypeError: add(): argument 'alpha' must be Number, not NoneType

Detectron2 version: 0.6

Expected behaviour is the training loop runs without error.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
Roywangjcommented, Aug 20, 2022

I have met the same problem, i find the setting “weight_decay” don’t suppport numbers like 1e-4, when i replace 1e-4 to 0.0001, it fixed.

2reactions
reubenwenischcommented, Feb 23, 2022

@dedoogong This error had come with using detectron2 latest version I moved it to previous version and the code started working. Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

add(): argument 'other' (position 1) must be Tensor, not numpy ...
I am testing a ResNet-34 trained_model using Pytorch and fastai on a linux system with the latest anaconda3. To run it as a...
Read more >
argument 'input' (position 1) must be Tensor, not NoneType
Hi I try to create CNN network and this error pop up when i try to run it can anyone help class gface(nn.Module):...
Read more >
int() argument must be a string or real number not NoneType
The Python "TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'" occurs when we pass a...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
(was: =dev-java/jdbm-1.0 is available)" status:RESOLVED resolution:OBSOLETE severity:enhancement · Bug:107027 - "dev-vcs/cvsd init script for is not ...
Read more >
Changelog — Python 3.11.1 documentation
The errno modules exposes the new error number. getpath.py now ignores ... gh-91207: Fix stylesheet not working in Windows CHM htmlhelp docs and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found