Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test error #22

Closed
gouqi666 opened this issue May 20, 2022 · 3 comments
Closed

test error #22

gouqi666 opened this issue May 20, 2022 · 3 comments

Comments

@gouqi666
Copy link

when I run ' pythontest.py model=rebel_model data=conll04_data train=conll04_train do_predict=True checkpoint_path="path_to_checkpoint" ', I can't load my model, the error is 'omegaconf.errors.ConfigKeyError: 'str' object has no attribute 'dict''.
image
image
I am not familiar with pytorch-lightning, could u help me?

@LittlePea13
Copy link
Collaborator

Yes, there was a bug when loading from the hydra config to the checkpoint. I commented out that line (it is safe to do so) which probably is not the most elegant way to solve the issue. However I believe this doesn't happen anymore, so you could upgrade your pytorch-lightning version and see if it gets fixed.

Sorry for the inconvenience, I plan to update the requirements.txt file with more recent versions, but haven't found the time to check that nothing breaks if I do so.

@WeiminXiong
Copy link

I still have this problem, how can I fixed it? could you please explain it more clearly

@WeiminXiong
Copy link

Traceback (most recent call last):
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 256, in setitem
self.__set_impl(key=key, value=value)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 266, in __set_impl
self._set_item_impl(key, value)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/basecontainer.py", line 398, in _set_item_impl
self._validate_set(key, value)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 143, in _validate_set
self._validate_set_merge_impl(key, value, is_assign=True)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 148, in _validate_set_merge_impl
vk = get_value_kind(value)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/omegaconf/_utils.py", line 365, in get_value_kind
if value == "???":
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/transformers/configuration_utils.py", line 737, in eq
return self.dict == other.dict
AttributeError: 'str' object has no attribute 'dict'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/weimin/rebel/src/test.py", line 118, in main
train(conf)
File "/home/weimin/rebel/src/test.py", line 102, in train
pl_module = pl_module.load_from_checkpoint(checkpoint_path = conf.checkpoint_path, config = config, tokenizer = tokenizer, model = model)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 157, in load_from_checkpoint
checkpoint[cls.CHECKPOINT_HYPER_PARAMS_KEY].update(kwargs)
File "/home/weimin/miniconda3/envs/rebel/lib/python3.7/_collections_abc.py", line 841, in update
self[key] = other[key]
omegaconf.errors.ConfigKeyError: 'str' object has no attribute 'dict'
full_key: config
reference_type=Optional[Dict[Union[str, Enum], Any]]
object_type=dict

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants