Skip to content

ValueError: Unrecognized configuration class <class> #25537

@innat

Description

@innat

System Info

transformer v. 4.31.0'

Who can help?

@sgugger

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

I tried to load 'microsoft/deberta-v3-large' using AutoModelForMultipleChoice and TFAutoModelForMultipleChoice class. But I got error with TF* class.

from transformers import AutoModelForMultipleChoice
from transformers import TFAutoModelForMultipleChoice

deberta_v3_large = 'microsoft/deberta-v3-large'

# OK
torch_model = AutoModelForMultipleChoice.from_pretrained(deberta_v3_large)

# NOT OK
tf_model = TFAutoModelForMultipleChoice.from_pretrained(deberta_v3_large)

Errro logs

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ ❱ 1 tf_model = TFAutoModelForMultipleChoice.from_pretrained(deberta_v3_large)                    │
│   2                                                                                              │
│                                                                                                  │
│ /opt/conda/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:496 in          │
│ from_pretrained                                                                                  │
│                                                                                                  │
│   493 │   │   │   return model_class.from_pretrained(                                            │
│   494 │   │   │   │   pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs,   │
│   495 │   │   │   )                                                                              │
│ ❱ 496 │   │   raise ValueError(                                                                  │
│   497 │   │   │   f"Unrecognized configuration class {config.__class__} for this kind of AutoM   │
│   498 │   │   │   f"Model type should be one of {', '.join(c.__name__ for c in cls._model_mapp   │
│   499 │   │   )                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Unrecognized configuration class <class 
'transformers.models.deberta_v2.configuration_deberta_v2.DebertaV2Config'> for this kind of AutoModel: 
TFAutoModelForMultipleChoice.
Model type should be one of AlbertConfig, BertConfig, CamembertConfig, ConvBertConfig, DistilBertConfig, 
ElectraConfig, FlaubertConfig, FunnelConfig, LongformerConfig, MobileBertConfig, MPNetConfig, RemBertConfig, 
RobertaConfig, RobertaPreLayerNormConfig, RoFormerConfig, XLMConfig, XLMRobertaConfig, XLNetConfig.

Expected behavior

They should work in same manner!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions