The following code produces error:
from transformers import AutoModelForSequenceClassification
model_name = ‘openai/gpt-oss-20b’
model = AutoModelForSequenceClassification.from_pretrained(model_name)
Error:
ValueError:
Unrecognized configuration class <class 'transformers.models.gpt_oss.configuration_gpt_oss.GptOssConfig'> for this kind of
AutoModel: AutoModelForSequenceClassification.
My transformers._version_ = 4.55.4
Here is full trace:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/ipython-input-2075936628.py in <cell line: 0>() 1 from transformers import AutoModelForSequenceClassification
2 model_name = 'openai/gpt-oss-20b'
----> 3 model = AutoModelForSequenceClassification.from_pretrained(model_name)
/usr/local/lib/python3.12/dist-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs) 601 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs 602 )
--> 603 raise ValueError(
604 f"Unrecognized configuration class {config.__class__} for this kind of AutoModel: {cls.__name__}.\n"
605 f"Model type should be one of {', '.join(c.__name__ for c in cls._model_mapping)}."
ValueError: Unrecognized configuration class <class 'transformers.models.gpt_oss.configuration_gpt_oss.GptOssConfig'> for this kind of AutoModel: AutoModelForSequenceClassification. Model type should be one of
AlbertConfig, ArceeConfig, BartConfig, BertConfig, BigBirdConfig, BigBirdPegasusConfig, BioGptConfig, BloomConfig, CamembertConfig, CanineConfig,
LlamaConfig, ConvBertConfig, CTRLConfig, Data2VecTextConfig, DebertaConfig,
DebertaV2Config, DeepseekV2Config, DiffLlamaConfig, DistilBertConfig,
DogeConfig, ElectraConfig, ErnieConfig, ErnieMConfig, EsmConfig, Exaone4Config, FalconConfig, FlaubertConfig, FNetConfig, FunnelConfig, GemmaConfig, Gemma2Config, Gemma3Config, GlmConfig, Glm4Config, GPT2Config, GPT2Config,
GPTBigCodeConfig, GPTNeoConfig, GPTNeoXConfig, GPTJConfig, HeliumConfig,
IBertConfig, JambaConfig, JetMoeConfig, LayoutLMConfig, LayoutLMv2Config, LayoutLMv3Config, LEDConfig, LiltConfig, LlamaConfig, LongformerConfig,
LukeConfig, MarkupLMConfig, MBartConfig, MegaConfig, MegatronBertConfig,
MiniMaxConfig, MistralConfig, MixtralConfig, MobileBertConfig,
ModernBertConfig, ModernBertDecoderConfig, MPNetConfig, MptConfig, MraConfig,
MT5Config, MvpConfig, NemotronConfig, NezhaConfig, NystromformerConfig, OpenLlamaConfig, OpenAIGPTConfig, OPTConfig, PerceiverConfig, PersimmonConfig, PhiConfig, Phi3Config, PhimoeConfig, PLBartConfig, QDQBertConfig, Qwen2Config,
Qwen2MoeConfig, Qwen3Config, Qwen3MoeConfig, ReformerConfig, RemBertConfig,
RobertaConfig, RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig,
SmolLM3Config, SqueezeBertConfig, StableLmConfig, Starcoder2Config, T5Config, T5GemmaConfig, TapasConfig, TransfoXLConfig, UMT5Config, XLMCon...