transformers - 💡(How to fix) Fix ValueError: Unrecognized model in allenai/Olmo-Hybrid-Instruct-SFT-7B. Should have a `model_type` key in its config.json. [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#44496Fetched 2026-04-08 00:28:01
View on GitHub
Comments
4
Participants
3
Timeline
9
Reactions
0
Author
Timeline (top)
commented ×4subscribed ×2closed ×1labeled ×1

Error Message

from transformers import AutoConfig AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B') Traceback (most recent call last): File "<stdin>", line 1, in <module> AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B') ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../transformers/src/transformers/models/auto/configuration_auto.py", line 1471, in from_pretrained raise ValueError( ...<2 lines>... ) ValueError: Unrecognized model in allenai/Olmo-Hybrid-Instruct-SFT-7B. Should have a model_type key in its config.json.

Code Example

>>> from transformers import AutoConfig
>>> AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../transformers/src/transformers/models/auto/configuration_auto.py", line 1471, in from_pretrained
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Unrecognized model in allenai/Olmo-Hybrid-Instruct-SFT-7B. Should have a `model_type` key in its config.json.
>>>
RAW_BUFFERClick to expand / collapse

System Info

  • transformers version: 5.3.0.dev0 (main)
  • Platform: macOS-15.7.4-arm64-arm-64bit-Mach-O
  • Python version: 3.13.2
  • Huggingface_hub version: 1.3.1
  • Safetensors version: 0.5.3
  • Accelerate version: 1.12.0
  • Accelerate config: not found
  • DeepSpeed version: not installed
  • PyTorch version (accelerator?): 2.9.0 (NA)
  • Using distributed or parallel set-up in script?: no

Who can help?

@CyrilVallez

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

>>> from transformers import AutoConfig
>>> AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    AutoConfig.from_pretrained('allenai/Olmo-Hybrid-Instruct-SFT-7B')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../transformers/src/transformers/models/auto/configuration_auto.py", line 1471, in from_pretrained
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Unrecognized model in allenai/Olmo-Hybrid-Instruct-SFT-7B. Should have a `model_type` key in its config.json.
>>>

However, model_type is indeed set in config.json https://huggingface.co/allenai/Olmo-Hybrid-Instruct-SFT-7B/blob/main/config.json

Expected behavior

The config should load as expected

extent analysis

Fix Plan

1. Update Transformers Library

Update the transformers library to the latest version (5.3.0 or later) using pip:

pip install --upgrade transformers

2. Check Model Configuration

Verify that the model configuration is correctly loaded by checking the model_type key in the config.json file:

import json

with open('config.json') as f:
    config = json.load(f)
print(config['model_type'])

This should print the expected model type.

3. Use from_pretrained with config_name and model_name

Instead of using AutoConfig.from_pretrained with the model name, use the config_name and model_name separately:

from transformers import AutoConfig, AutoModelForSequenceClassification

config_name = 'allenai/Olmo-Hybrid-Instruct-SFT-7B'
model_name = 'allenai/Olmo-Hybrid-Instruct-SFT-7B'

config = AutoConfig.from_pretrained(config_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name, config=config)

This should load the model configuration and model weights correctly.

Verification

  1. Check that the model configuration is loaded correctly by printing the model_type key.
  2. Verify that the model can be loaded and used without errors.

Extra Tips

  • Make sure to update the transformers library to the latest version to ensure you have the latest bug fixes and features.
  • When loading models from Hugging Face Hub, use the config_name and model_name separately to avoid issues with model configuration loading.
  • Always check the model configuration and weights loading by printing or logging relevant information to ensure everything is loaded correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The config should load as expected

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING