HHousen / TransformerSum

Models to perform neural summarization (extractive and abstractive) using machine learning transformers and a tool to convert abstractive summarization datasets to the extractive task.
https://transformersum.rtfd.io
GNU General Public License v3.0
428 stars 58 forks source link

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

Closed BeaBea1234 closed 3 years ago

BeaBea1234 commented 3 years ago

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 commented 3 years ago

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