transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Unrecognized configuration class <class 'transformers.configuration_electra.ElectraConfig'>

Open cktsangal opened this issue 6 years ago • 2 comments

🐛 Bug

Information

Model I am using : ahotrod/electra_large_discriminator_squad2_512

This problem happened again, when I use ELECTRA on question-answering pipeline. My Transformers version is 2.11.0.

Code:

from transformers import pipeline, AutoTokenizer, AutoModelForQuestionAnswering

tokenizer = AutoTokenizer.from_pretrained("ahotrod/electra_large_discriminator_squad2_512") model = AutoModelForQuestionAnswering.from_pretrained("ahotrod/electra_large_discriminator_squad2_512")

Error:

Traceback (most recent call last): File "albert_qa.py", line 5, in model = AutoModelForQuestionAnswering.from_pretrained("ahotrod/electra_large_discriminator_squad2_512") File "/home/aim/ANDY-project/sentence-transformers-env/lib/python3.6/site-packages/transformers/modeling_auto.py", line 1004, in from_pretrained ", ".join(c.name for c in MODEL_FOR_QUESTION_ANSWERING_MAPPING.keys()), ValueError: Unrecognized configuration class <class 'transformers.configuration_electra.ElectraConfig'> for this kind of AutoModel: AutoModelForQuestionAnswering.

  • transformers version: 2.11.0
  • Platform: Ubuntu
  • Python version: 3.6.9
  • PyTorch version (GPU?): 1.5.1

cktsangal avatar Jul 14 '20 14:07 cktsangal

Hi! Even though the ELECTRA model was added in version v2.8.0, the ElectraForQuestionAnswering head was only added in v3.0.0. You would need to upgrade your transformers version to at at least v3.0.0 for your code to work!

LysandreJik avatar Jul 27 '20 10:07 LysandreJik

I am trying to use pretrained Distilbert in EncoderDecoderModel but i am getting this error. How can i leverage pretrained distilbert in EncoderDecoderModel.

ValueError: Unrecognized configuration class <class 'transformers.configuration_distilbert.DistilBertConfig'> for this kind of AutoModel: AutoModelForCausalLM. Model type should be one of CamembertConfig, XLMRobertaConfig, RobertaConfig, BertConfig, OpenAIGPTConfig, GPT2Config, TransfoXLConfig, XLNetConfig, XLMConfig, CTRLConfig, ReformerConfig, BertGenerationConfig.

Aakash12980 avatar Oct 07 '20 14:10 Aakash12980