facebookresearch / facebookresearch/detectron2

Error when running inference using demo.py - <class 'functools.partial'> is not a valid type

Open
#5,130 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

Hey!

As described in the title, I'm facing an issue related to yacs library as it doesn't recognize the type function.partial inside
my config file which is generated by detectron2 platform.

Traceback (most recent call last):
  File "/raid/malik/github/EVA/EVA-01/det/./demo/demo.py", line 100, in <module>
    cfg = setup_cfg(args)
  File "/raid/malik/github/EVA/EVA-01/det/./demo/demo.py", line 29, in setup_cfg
    cfg.merge_from_file(args.config_file)
  File "/raid/malik/github/EVA/EVA-01/det/detectron2/config/config.py", line 47, in merge_from_file
    loaded_cfg = type(self)(loaded_cfg)
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 86, in __init__
    init_dict = self._create_config_tree_from_dict(init_dict, key_list)
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 126, in _create_config_tree_from_dict
    dic[k] = cls(v, key_list=key_list + [k])
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 86, in __init__
    init_dict = self._create_config_tree_from_dict(init_dict, key_list)
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 126, in _create_config_tree_from_dict
    dic[k] = cls(v, key_list=key_list + [k])
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 86, in __init__
    init_dict = self._create_config_tree_from_dict(init_dict, key_list)
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 126, in _create_config_tree_from_dict
    dic[k] = cls(v, key_list=key_list + [k])
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 86, in __init__
    init_dict = self._create_config_tree_from_dict(init_dict, key_list)
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 129, in _create_config_tree_from_dict
    _assert_with_logging(
  File "/home/research/anaconda3/envs/eva/lib/python3.9/site-packages/yacs/config.py", line 545, in _assert_with_logging
    assert cond, msg
AssertionError: Key model.backbone.net.norm_layer with value <class 'functools.partial'> is not a valid type; valid types: {<class 'NoneType'>, <class 'int'>, <class 'float'>, <class 'str'>, <class 'list'>, <class 'tuple'>, <class 'bool'>}

Thanks,
Abdulmalik

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with demo/demo.py, especially setup_cfg, then inspect detectron2/config/config.py and the yacs config construction shown in the traceback. Reproduce the failure by running demo.py with the generated configuration; done means configuration loading completes and inference starts without the invalid functools.partial type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.