AttributeError: '_LazyAutoMapping' object has no attribute '_mapping'
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!
Hello! Could you provide the details of your environment please?<|||||>This is the one I'm using: 

Python 3.8.10
# packages in environment at /usr/local/envs/transformersum:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                      1_llvm    conda-forge
abseil-cpp                20210324.2           h9c3ff4c_0    conda-forge
absl-py                   0.13.0             pyhd8ed1ab_0    conda-forge
aiohttp                   3.7.4.post0      py38h497a2fe_0    conda-forge
alabaster                 0.7.12                     py_0    conda-forge
arrow-cpp                 5.0.0           py38h4026a5f_3_cpu    conda-forge
async-timeout             3.0.1                   py_1000    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
aws-c-cal                 0.5.11               h95a6274_0    conda-forge
aws-c-common              0.6.2                h7f98852_0    conda-forge
aws-c-event-stream        0.2.7               h3541f99_13    conda-forge
aws-c-io                  0.10.5               hfb6a706_0    conda-forge
aws-checksums             0.1.11               ha31a3da_7    conda-forge
aws-sdk-cpp               1.8.186              hb4091e7_3    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
bcj-cffi                  0.5.1            py38h709712a_0    conda-forge
blinker                   1.4                        py_1    conda-forge
brotli-python             1.0.9            py38h709712a_5    conda-forge
brotlicffi                1.0.9.2          py38h709712a_0    conda-forge
brotlipy                  0.7.0           py38h497a2fe_1001    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.17.2               h7f98852_0    conda-forge
ca-certificates           2021.5.30            ha878542_0    conda-forge
cachetools                4.2.2              pyhd8ed1ab_0    conda-forge
catalogue                 2.0.5            py38h578d9bd_0    conda-forge
certifi                   2021.5.30        py38h578d9bd_0    conda-forge
cffi                      1.14.6           py38ha65f79e_0    conda-forge
chardet                   4.0.0            py38h578d9bd_1    conda-forge
charset-normalizer        2.0.0              pyhd8ed1ab_0    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
conllu                    4.4.1              pyhd8ed1ab_0    conda-forge
cryptography              3.4.7            py38ha5dfef3_0    conda-forge
cymem                     2.0.5            py38h709712a_2    conda-forge
cython-blis               0.7.4            py38h5c078b8_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
datasets                  1.11.0             pyhd8ed1ab_0    conda-forge
dill                      0.3.4              pyhd8ed1ab_0    conda-forge
docutils                  0.17.1           py38h578d9bd_0    conda-forge
et_xmlfile                1.0.1                   py_1001    conda-forge
filelock                  3.0.12             pyh9f0ad1d_0    conda-forge
fsspec                    2021.8.1           pyhd8ed1ab_0    conda-forge
future                    0.18.2           py38h578d9bd_3    conda-forge
gflags                    2.2.2             he1b5a44_1004    conda-forge
glog                      0.5.0                h48cff8f_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
google-auth               1.35.0             pyh6c4a22f_0    conda-forge
google-auth-oauthlib      0.4.6              pyhd8ed1ab_0    conda-forge
grpc-cpp                  1.39.1               hf1f433d_0    conda-forge
grpcio                    1.38.1           py38hdd6454d_0    conda-forge
huggingface_hub           0.0.16             pyhd8ed1ab_0    conda-forge
icu                       68.1                 h58526e2_0    conda-forge
idna                      3.1                pyhd3deb0d_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
importlib-metadata        4.8.1            py38h578d9bd_0    conda-forge
importlib_metadata        4.8.1                hd8ed1ab_0    conda-forge
jdcal                     1.4.1                      py_0    conda-forge
jinja2                    3.0.1              pyhd8ed1ab_0    conda-forge
joblib                    1.0.1              pyhd8ed1ab_0    conda-forge
krb5                      1.19.2               hcc1bbae_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libblas                   3.9.0            11_linux64_mkl    conda-forge
libbrotlicommon           1.0.9                h7f98852_5    conda-forge
libbrotlidec              1.0.9                h7f98852_5    conda-forge
libbrotlienc              1.0.9                h7f98852_5    conda-forge
libcblas                  3.9.0            11_linux64_mkl    conda-forge
libcurl                   7.78.0               h2574ce0_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               hcdb4288_3    conda-forge
libffi                    3.3                  h58526e2_2    conda-forge
libgcc-ng                 11.1.0               hc902ee8_8    conda-forge
libgfortran-ng            11.1.0               h69a702a_8    conda-forge
libgfortran5              11.1.0               h6c583b3_8    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0            11_linux64_mkl    conda-forge
libnghttp2                1.43.0               h812cca2_0    conda-forge
libprotobuf               3.16.0               h780b84a_0    conda-forge
libssh2                   1.10.0               ha56f1ee_0    conda-forge
libstdcxx-ng              11.1.0               h56837e0_8    conda-forge
libthrift                 0.14.2               he6d91bd_1    conda-forge
libutf8proc               2.6.1                h7f98852_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
libxslt                   1.1.33               h15afd5d_2    conda-forge
llvm-openmp               12.0.1               h4bd325d_1    conda-forge
lxml                      4.6.3            py38hf1fe3a4_0    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
markdown                  3.3.4              pyhd8ed1ab_0    conda-forge
markupsafe                2.0.1            py38h497a2fe_0    conda-forge
mkl                       2021.3.0           h726a3e6_557    conda-forge
multidict                 5.1.0            py38h497a2fe_1    conda-forge
multiprocess              0.70.12.2        py38h497a2fe_0    conda-forge
multivolumefile           0.2.3              pyhd8ed1ab_0    conda-forge
murmurhash                1.0.5            py38h709712a_0    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
ninja                     1.10.2               h4bd325d_0    conda-forge
numpy                     1.21.2           py38he2449b9_0    conda-forge
oauthlib                  3.1.1              pyhd8ed1ab_0    conda-forge
openpyxl                  3.0.7              pyhd8ed1ab_0    conda-forge
openssl                   1.1.1k               h7f98852_1    conda-forge
orc                       1.6.10               h58a87f1_0    conda-forge
packaging                 21.0               pyhd8ed1ab_0    conda-forge
pandas                    1.3.2            py38h43a58ef_0    conda-forge
parquet-cpp               1.5.1                         2    conda-forge
pathy                     0.6.0              pyhd8ed1ab_0    conda-forge
pip                       21.2.4             pyhd8ed1ab_0    conda-forge
preshed                   3.0.5            py38h709712a_1    conda-forge
protobuf                  3.16.0           py38h709712a_0    conda-forge
py7zr                     0.16.1             pyhd8ed1ab_1    conda-forge
pyarrow                   5.0.0           py38h1bc9799_3_cpu    conda-forge
pyasn1                    0.4.8                      py_0    conda-forge
pyasn1-modules            0.2.7                      py_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pycryptodomex             3.10.1           py38h497a2fe_0    conda-forge
pydantic                  1.8.2            py38h497a2fe_0    conda-forge
pydeprecate               0.3.1              pyhd8ed1ab_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyjwt                     2.1.0              pyhd8ed1ab_0    conda-forge
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyppmd                    0.16.1           py38h709712a_0    conda-forge
pysocks                   1.7.1            py38h578d9bd_3    conda-forge
python                    3.8.10          h49503c6_1_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-xxhash             2.0.2            py38h497a2fe_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytorch                   1.9.0           cpu_py38h4bbe6ce_2    conda-forge
pytorch-lightning         1.4.5              pyhd8ed1ab_0    conda-forge
pytorch-ranger            0.1.1              pyhd8ed1ab_0    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pyyaml                    5.4.1            py38h497a2fe_1    conda-forge
pyzstd                    0.14.4           py38hd4831d6_2    conda-forge
re2                       2021.08.01           h9c3ff4c_0    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
regex                     2021.8.28        py38h497a2fe_0    conda-forge
requests                  2.26.0             pyhd8ed1ab_0    conda-forge
requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
rsa                       4.7.2              pyh44b312d_0    conda-forge
s2n                       1.0.10               h9b69904_0    conda-forge
sacremoses                0.0.43             pyh9f0ad1d_0    conda-forge
scikit-learn              0.24.2           py38h1561384_1    conda-forge
scipy                     1.7.1            py38h56a6a73_0    conda-forge
setuptools                57.4.0           py38h578d9bd_0    conda-forge
shellingham               1.4.0              pyh44b312d_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sleef                     3.5.1                h7f98852_1    conda-forge
smart_open                5.2.1              pyhd8ed1ab_0    conda-forge
snappy                    1.1.8                he1b5a44_3    conda-forge
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
spacy                     3.1.2            py38h2b96118_0    conda-forge
spacy-legacy              3.0.8              pyhd8ed1ab_0    conda-forge
sphinx                    4.1.2              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_0    conda-forge
sqlite                    3.36.0               h9cd32fc_0    conda-forge
srsly                     2.4.1            py38h709712a_0    conda-forge
tbb                       2021.3.0             h4bd325d_0    conda-forge
tensorboard               2.6.0              pyhd8ed1ab_1    conda-forge
tensorboard-data-server   0.6.0            py38h3e25421_0    conda-forge
tensorboard-plugin-wit    1.8.0              pyh44b312d_0    conda-forge
texttable                 1.6.4              pyhd8ed1ab_0    conda-forge
thinc                     8.0.8            py38hfc89cab_0    conda-forge
threadpoolctl             2.2.0              pyh8a188c0_0    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
tokenizers                0.10.1           py38hb63a372_0    conda-forge
torch-optimizer           0.1.0              pyhd8ed1ab_0    conda-forge
torchmetrics              0.5.1              pyhd8ed1ab_0    conda-forge
tqdm                      4.49.0             pyh9f0ad1d_0    conda-forge
transformers              4.9.2              pyhd8ed1ab_0    conda-forge
typer                     0.3.2              pyhd8ed1ab_0    conda-forge
typing-extensions         3.10.0.0             hd8ed1ab_0    conda-forge
typing_extensions         3.10.0.0           pyha770c72_0    conda-forge
urllib3                   1.26.6             pyhd8ed1ab_0    conda-forge
wasabi                    0.8.2              pyh44b312d_0    conda-forge
werkzeug                  2.0.1              pyhd8ed1ab_0    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xxhash                    0.8.0                h7f98852_3    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h516909a_0    conda-forge
yarl                      1.6.3            py38h497a2fe_2    conda-forge
zipp                      3.5.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h516909a_1010    conda-forge
zstd                      1.5.0                ha95c52a_0    conda-forge
# conda environments:
#
base                     /usr/local
transformersum_new_python  *  /usr/local/envs/transformersum<|||||>Does this still happen if you install transformers from our channel? 
```
conda install -c huggingface transformers
```<|||||>it worked, thank you very much! I also had to install huggingface tokenizers=0.10.1, in case this information might help someone.