yl-1993 / learn-to-cluster

Learning to Cluster Faces (CVPR 2019, CVPR 2020)
MIT License
705 stars 143 forks source link

AttributeError: 'ConfigDict' object has no attribute 'model' #36

Closed keeprunningcelin closed 4 years ago

keeprunningcelin commented 4 years ago

error when run sh scripts/vegcn/test_gcn_e_ms1m.sh

Traceback (most recent call last): File "vegcn/main.py", line 105, in main() File "vegcn/main.py", line 47, in main cfg = Config.fromfile(args.config) File "/home/celin/anaconda3/envs/gtw_center/lib/python3.6/site-packages/mmcv/utils/config.py", line 152, in fromfile cfg_dict, cfg_text = Config._file2dict(filename) File "/home/celin/anaconda3/envs/gtw_center/lib/python3.6/site-packages/mmcv/utils/config.py", line 91, in _file2dict mod = import_module('_tempconfig') File "/home/celin/anaconda3/envs/gtw_center/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/tmp/tmpwsk1pmar/_tempconfig.py", line 21, in File "/home/celin/anaconda3/envs/gtw_center/lib/python3.6/site-packages/mmcv/utils/config.py", line 264, in getattr return getattr(self._cfg_dict, name) File "/home/celin/anaconda3/envs/gtw_center/lib/python3.6/site-packages/mmcv/utils/config.py", line 34, in getattr raise ex AttributeError: 'ConfigDict' object has no attribute 'model'

yl-1993 commented 4 years ago

Hi @keeprunningcelin, have you modified the vegcn/configs/cfg_test_gcne_ms1m.py? It is a bit of weird that the AttributeError is raised when parsing the config. BTW, does sh scripts/vegcn/test_gcn_v_ms1m.sh work well?

rose-jinyang commented 4 years ago

Hi I also met the same issue. I ran _sh scripts/vegcn/train_gcn_vms1m.sh

AttributeError: 'ConfigDict' object has no attribute 'model' Traceback (most recent call last): File "vegcn/main.py", line 104, in main() File "vegcn/main.py", line 47, in main cfg = Config.fromfile(args.config) File "/home/vishwam/anaconda3/lib/python3.7/site-packages/mmcv/utils/config.py", line 152, in fromfile cfg_dict, cfg_text = Config._file2dict(filename) File "/home/vishwam/anaconda3/lib/python3.7/site-packages/mmcv/utils/config.py", line 91, in _file2dict mod = import_module('_tempconfig') File "/home/vishwam/anaconda3/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/var/tmp/tmppvw8pasv/_tempconfig.py", line 38, in File "/home/vishwam/anaconda3/lib/python3.7/site-packages/mmcv/utils/config.py", line 264, in getattr return getattr(self._cfg_dict, name) File "/home/vishwam/anaconda3/lib/python3.7/site-packages/mmcv/utils/config.py", line 34, in getattr raise ex AttributeError: 'ConfigDict' object has no attribute 'model'

What is your mmcv version?

yl-1993 commented 4 years ago

@keeprunningcelin @rose-jinyang Thanks for posting the issue. As discussed with @rose-jinyang, it seems to be the problem of mmcv version. In my test, it works fine under mmcv==0.2.5 and mmcv==0.2.14. I will try to fix it under the latest mmcv.

rose-jinyang commented 4 years ago

You're right. It works well under mmcv==0.2.14. Thanks

yl-1993 commented 4 years ago

Hi @keeprunningcelin, for current usage, you may need to switch to previous version of mmcv by pip install mmcv==0.3.2. It works well when mmcv is under 0.4.0.

Besides, I post an issue on https://github.com/open-mmlab/mmcv/issues/248 to discuss this problem. You can keep an eye on the discussions.

keeprunningcelin commented 4 years ago

Thanks @yl-1993 .I change the version of mmcv. It works well.

yl-1993 commented 4 years ago

Hi @keeprunningcelin, mmcv has fixed this issue. I think it be available after next mmcv release. View the above issue to check more details.

linjiawen2019 commented 4 years ago

@yl-1993 Hi, I ran train_gcn_e_ms1m.py to train my own dataset, but also met the similar problem:

Traceback (most recent call last): File "vegcn/main.py", line 104, in main() File "vegcn/main.py", line 47, in main cfg = Config.fromfile(args.config) File "/data3/linjiawen/anaconda3/envs/pytorch1.0/lib/python3.7/site-packages/mmcv/utils/config.py", line 86, in fromfile mod = import_module(module_name) File "/data3/linjiawen/anaconda3/envs/pytorch1.0/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/data3/linjiawen/learn-to-cluster/vegcn/configs/cfg_train_gcne_ms1m.py", line 63, in extract_gcn_v(test_feat_path, test_pred_conf_path, 'test_data', gcnv_cfg) File "/data3/linjiawen/learn-to-cluster/vegcn/extract.py", line 28, in extract_gcn_v dataset = build_dataset(cfg.model['type'], cfg[data_name]) File "/data3/linjiawen/learn-to-cluster/vegcn/datasets/init.py", line 13, in build_dataset return factorymodel_type File "/data3/linjiawen/learn-to-cluster/vegcn/datasets/gcn_v_dataset.py", line 50, in init knn_prefix = os.path.join(cfg.prefix, 'knns', cfg.name) File "/data3/linjiawen/anaconda3/envs/pytorch1.0/lib/python3.7/site-packages/mmcv/utils/config.py", line 28, in getattr raise ex AttributeError: 'ConfigDict' object has no attribute 'prefix'

I tried several version of mmcv but still failed, 0.2.15, 0.2.14, 0.3.2 they didn't work. And I checked the config file "cfg_train_gcnv_ms1m.py" there is a "predix" in it. Could you tell whether the newest version of mmcv works?

Before this I have met "AttributeError: 'ConfigDict' object has no attribute 'model' ", and I changed the mmcv version to 0.3.2 and it worked, but now I have this. Thanks for your reply!

yl-1993 commented 4 years ago

@linjiawen2019 Could you please give more detailed information about your environment? I tested it under following settings and they all seemed to work well. (1) torch==1.1.0, mmcv==0.5.6; (2) torch==1.1.0, mmcv==0.3.2; (3) torch==0.4.0, mmcv==0.2.15

yimilirui commented 1 year ago

@linjiawen2019您能不能提供有关您的环境的更多详细信息? 我在下面的设置下对其进行了测试,它们似乎都运行良好。 (1) torch==1.1.0, mmcv==0.5.6; (2) torch==1.1.0, mmcv==0.3.2; (3) torch==0.4.0,mmcv==0.2.15

if torch == 1.7.1, mmcv==??, I meet the same question. Can you tell me the right version? Thank you very much!

userzsy1108 commented 1 year ago

if torch == 1.12.1, mmcv==??, I meet the same question. Can you tell me the right version? Thank you very much!