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.

AssertionError: Invalid type <class 'NoneType'> for key WEIGHT_DECAY_BIAS

See original GitHub issue

Hi, WEIGHT_DECAY_BIAS parameter in detectron2/config/defaults.py that exists for Detectron v1 training causes the mentioned error when you try to import the file. If you change the None value with 0 (line 560), the bug seems to be fixed but I am not sure if that change breaks something else.

Instructions To Reproduce the 🐛 Bug:

  1. In a Python terminal: from detectron2.config import configurable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/detectron2/config/__init__.py", line 2, in <module>
    from .compat import downgrade_config, upgrade_config
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/detectron2/config/compat.py", line 28, in <module>
    from .defaults import _C
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/detectron2/config/defaults.py", line 560, in <module>
    _C.SOLVER.WEIGHT_DECAY_BIAS = None  # None means following WEIGHT_DECAY
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/fvcore/common/config.py", line 148, in __setattr__
    super().__setattr__(name, val)
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/yacs/config.py", line 155, in __setattr__
    _assert_with_logging(
  File "/storage/miniconda/envs/myenv/lib/python3.9/site-packages/yacs/config.py", line 521, in _assert_with_logging
    assert cond, msg
AssertionError: Invalid type <class 'NoneType'> for key WEIGHT_DECAY_BIAS; valid types = {<class 'float'>, <class 'list'>, <class 'str'>, <class 'int'>, <class 'bool'>, <class 'tuple'>}

Environment:

I am using torch 1.10.0 with prebuilt detectron2 0.6 with CUDA 11.1. The mentioned codepiece still exists in the main branch, so I don’t think this is related with my environment.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
submagrcommented, Jan 25, 2022

@zhao-yiqun try following in your environment:

pip uninstall yacs
pip install yacs --upgrade

For some reason, upgrading yacs alone was not sufficient for me.

4reactions
hiyygcommented, Nov 4, 2021

Hey, I solved it by updating yacs to >= 0.1.8.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(Pytorch)AssertionError: Invalid type <class 'NoneType'>
I tried to retrain LoFTR(2021 CVPR paper), but I have faced some bugs. I'm a newcomer of deep-learning, please bear with me.
Read more >
AssertionError: Invalid type <class 'NoneType'> for key ...
TypeError: Fetch argument None has invalid type <class 'NoneType'> 错误代码: import tensorflow as tf merged = tf.summary.merge_all() ...
Read more >
How do i figure out what's wrong with an invalid type error?
I'm getting the following error with my model. ValueError: Invalid type provided to write_stan_json for key 'cl_pure_premium' as part of ...
Read more >
Invalid constant scalar expression: <class 'NoneType'> - 综合 ...
Vector([fragCoord_x, fragCoord_y]) ) if __name__ == "__main__": gui = ti.GUI("Julia Quaternion 3", pixels.shape) makeIChannel0() iTime[None] ...
Read more >
ValueError: Unexpected grad_sample type: <class 'NoneType ...
Hello, I am using PyTorch 1.10.0+cu102 and Opacus 1.0.0 and would like to use differential privacy for the training of an image classifier....
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