wzhouxiff / RestoreFormer

[CVPR 2022] RestoreFormer: High-Quality Blind Face Restoration from Undegraded Key-Value Pairs
Apache License 2.0
333 stars 35 forks source link

When run the main.py after setting 'HQ_Dictionary' to ‘conf_name’ in scripts/run.sh.I get an error: Missing key comp_weight #5

Closed wizaaaard closed 2 years ago

wizaaaard commented 2 years ago

Hello, I appreciate your work very much, but I have encountered some problems. As the title says, I set 'HQ_Dictionary' to ‘conf_name’ in scripts/run.sh before I using sh scripts/run.sh command, prepare for training. But I got the following error message:

_Traceback (most recent call last): File "main.py", line 481, in model = instantiate_from_config(config.model) File "main.py", line 160, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "/opt/data/private/DESKTOPforG/face_restoration/RestoreFormer/RestoreFormer-main/RestoreFormer/models/vqgan_v1.py", line 30, in init if lossconfig['params']['comp_weight'] or lossconfig['params']['comp_style_weight']: File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 377, in getitem self._format_and_raise(key=key, value=None, cause=e) File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/base.py", line 237, in _format_and_raise type_override=type_override, File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/_utils.py", line 873, in format_and_raise _raise(ex, cause) File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/_utils.py", line 771, in _raise raise ex.with_traceback(sys.exc_info()[2]) # set env var OC_CAUSE=1 for full trace File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 371, in getitem return self._get_impl(key=key, default_value=_DEFAULTMARKER) File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 445, in _get_impl key=key, throw_on_missing_key=True, validate_key=validate_key File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/basecontainer.py", line 78, in _get_child throw_on_missing_key=throw_on_missing_key, File "/root/faceRESTORATION/anaconda3/envs/RestoreFormer/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 482, in _get_node raise ConfigKeyError(f"Missing key {key!s}") omegaconf.errors.ConfigKeyError: Missing key comp_weight full_key: model.params.lossconfig.params.comp_weight objecttype=dict**

I checked the code carefully and found that the problem lies in your _RestoreFormer.models.vqganv1, in the RestoreFormerModel class of this file, the statement on line 30 is "_if lossconfig['params']['comp_weight'] or lossconfig['params']['comp_styleweight']:". It is this statement that reports an error, because in HQ Dictionary.yaml_ file, I found that the _lossconfig['params']['compweight'] key does not exist exactly. Is this my use error or your project file error. I'm a beginner. Thank you very much. If you can reply and answer my questions, thank you again.

wzhouxiff commented 2 years ago

Thanks for you reminder, I have modified Line 13 of vqgan_v1.py to make it compatible to the situation that there is no comp_weight and comp_style_weight in the configure file.