Openai/gpt-oss-20b what heads are available

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...
1 Like

It seems to have just been implemented. GitHub version might work.

pip install git+https://github.com/huggingface/transformers
1 Like

Thank you so much again!

I need to download and later install this version of transformers offline.

Here is what I did:

!pip download git+https://github.com/huggingface/transformers -d ./wheels

and later I ran (offline) in Kaggle notebook:

!pip install wheels/transformers-4.57.0.dev0.zip

but it generated error:

Processing ./wheels/transformers-4.57.0.dev0.zip
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Is it possible to download with dependencies and save?

1 Like

For offline installation, you’ll probably need to use --no-index to avoid PyPI. Maybe like this?

# Online
# Build a wheel from GitHub (avoid sdists)
git clone https://github.com/huggingface/transformers
cd transformers
python -m pip install -U build
python -m build --wheel -o ../wheels
cd ..
# Offline
WH=/kaggle/input/<your-dataset>/wheels
pip install --no-index --find-links="$WH" "transformers==4.57.0.dev0"
1 Like

Thank you so much!

When I run in Kaggle notebook !build --wheel -o ../wheels

I get back: /bin/bash: line 1: build: command not found

I also tried unsuccessfully

!python -m build --wheel -o ../wheels

1 Like

Hmm, I might have forgotten to download build. I don’t know Kaggle…

# Online
# Build a wheel from GitHub (avoid sdists)
git clone https://github.com/huggingface/transformers
cd transformers
python -m pip install -U build
python -m build --wheel -o ../wheels
cd ..
python -m pip download --only-binary=:all: -d wheelhouse \
  build setuptools wheel packaging pyproject_hooks setuptools-scm
# Offline
WH=/kaggle/input/<your-dataset>/wheels
pip install --no-index --find-links="$WH" \
  build setuptools wheel packaging pyproject_hooks

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.