microsoft / nlp-recipes

Natural Language Processing Best Practices & Examples
MIT License
6.35k stars 915 forks source link

'DistilBertConfig' has no attribute 'pretrained_config_archive_map'[BUG] #606

Open Naviden opened 3 years ago

Naviden commented 3 years ago

Description

Running the tc_mnli_transformers notebook, gives me the following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-1-273aaa3f3492> in <module>
     19 #!pip install jsonlines
     20 from utils_nlp.common.pytorch_utils import dataloader_from_dataset
---> 21 from utils_nlp.dataset.multinli import load_pandas_df
     22 from utils_nlp.models.transformers.sequence_classification import (
     23     Processor, SequenceClassifier)

~/work/occ_temp/nlp-recipes/utils_nlp/dataset/multinli.py in <module>
     20 from utils_nlp.dataset.url_utils import extract_zip, maybe_download
     21 from utils_nlp.models.transformers.common import MAX_SEQ_LEN
---> 22 from utils_nlp.models.transformers.sequence_classification import Processor
     23 
     24 URL = "http://www.nyu.edu/projects/bowman/multinli/multinli_1.0.zip"

~/work/occ_temp/nlp-recipes/utils_nlp/models/transformers/sequence_classification.py in <module>
     16 supported_models = [
     17     list(x.pretrained_config_archive_map)
---> 18     for x in MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
     19 ]
     20 supported_models = sorted([x for y in supported_models for x in y])

~/work/occ_temp/nlp-recipes/utils_nlp/models/transformers/sequence_classification.py in <listcomp>(.0)
     16 supported_models = [
     17     list(x.pretrained_config_archive_map)
---> 18     for x in MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
     19 ]
     20 supported_models = sorted([x for y in supported_models for x in y])

AttributeError: type object 'DistilBertConfig' has no attribute 'pretrained_config_archive_map'

I tried to downgrade transformers to 2.0.0 with no luck

How do we replicate the bug?

I cloned the repo, copied the notebook in the root ad run it. I also had to install thwe following packages:

Expected behavior (i.e. solution)

import the libraries without problem

Other Comments

I should say that I'm on CPU machine so I'm not expecting to run the notebook without any problem but this issue seems irrelevant to CPU/GPU

ashishanand7 commented 3 years ago

Facing Same issue.. can we know the version of transformers being used in the repo ?

Edit : Install transformers==2.6.0 to fix the issue.