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

AttributeError: '_LazyAutoMapping' object has no attribute '_mapping' #60

Closed
BeaBea1234 opened this issue Sep 3, 2021 · 1 comment
Closed

Comments

@BeaBea1234
Copy link

For

from transformer.models.auto.modeling_auto import MODEL_MAPPING

I get the following error:

AttributeError: '_LazyAutoMapping' object has no attribute '_mapping'

The _LazyAutoMapping class does indeed not have the attribute _mapping (see https://github.com/huggingface/transformers/blob/master/src/transformers/models/auto/auto_factory.py). However, it has a function def iter(self) that is supposed to return iter(self._mapping.keys()), which does not exist in init(). Am I missing something here or is this an error that needs to be fixed?

This is the error message:

 File "/content/drive/MyDrive/SharedColabNotebooks/Code/transformersum/src/main.py", line 8, in <module>
    from extractive import ExtractiveSummarizer
 File "/content/drive/.shortcut-targets-by- 
    id/1AslFCJkKFwmDS9rtbO_CAdHbBWuL1I4A/SharedColabNotebooks/Code/transformersum/src/extractive.py", line 47, in <module>
     [m.model_type for m in MODEL_MAPPING]
 File "/usr/local/envs/transformersum_test/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py", line 528, in __iter__
       return iter(self._mapping.keys())
AttributeError: '_LazyAutoMapping' object has no attribute '_mapping'

Any help is greatly appreciated!

@HHousen
Copy link
Owner

HHousen commented Oct 12, 2021

This should now be resolved by 1395f37. Please let me know if this didn't work.

@HHousen HHousen closed this as completed Oct 12, 2021
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

2 participants