Repository navigation
🚨 [ALM] Add base model without head - #45534
Merged
Merged
Conversation
This was referenced Apr 20, 2026
Merged
# Conflicts: # src/transformers/models/audioflamingo3/modeling_audioflamingo3.py # src/transformers/models/glmasr/modeling_glmasr.py # src/transformers/models/granite_speech/modeling_granite_speech.py # src/transformers/models/granite_speech_plus/modeling_granite_speech_plus.py # src/transformers/models/musicflamingo/modeling_musicflamingo.py # src/transformers/models/musicflamingo/modular_musicflamingo.py # src/transformers/models/vibevoice_asr/modeling_vibevoice_asr.py # src/transformers/models/voxtral/modeling_voxtral.py # src/transformers/models/voxtral/modular_voxtral.py # src/transformers/models/voxtral_realtime/modeling_voxtral_realtime.py # tests/models/audioflamingo3/test_modeling_audioflamingo3.py # tests/models/glmasr/test_modeling_glmasr.py # tests/models/granite_speech/test_modeling_granite_speech.py # tests/models/musicflamingo/test_modeling_musicflamingo.py # tests/models/qwen2_audio/test_modeling_qwen2_audio.py # tests/models/vibevoice_asr/test_modeling_vibevoice_asr.py # tests/models/voxtral/test_modeling_voxtral.py
…rmers into alm-base-model-class
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: audioflamingo3, auto, glmasr, granite_speech, granite_speech_plus, musicflamingo, parakeet, qwen2_audio, vibevoice_asr, voxtral, voxtral_realtime |
3 of 6 tasks
yuchenxie4645
pushed a commit
to yuchenxie4645/transformers
that referenced
this pull request
May 28, 2026
* add a base model class * ensure BC via conversion mapping * auto classes * test updates * ensure BC for accessing attributes * simplify conversion mapping * convert modular * convert modular * apply to voxtral * convert modular * remove test_model_base_model_prefix overwrite * make * make * XXXModel class in doc * add GraniteSpeechPlusModel * tests now have a base_model_class * fix qwen2audio * class level base mappings * fix test_reverse_loading_mapping * fix * fix * nit * fix * deprec in 5.7 -> 5.15 * fix flaky test * fix flaky test * fix flaky test * remove forward_base_model_attrs * _supports_attention_backend in PretrainedModel * removed redundant get/set_input_embeddings * remove requires_grad_ handling * make fix-repo * fix voxtral realtime * update vibevoice_asr test * update test * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/glmasr/modeling_glmasr.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * make fix-repo --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
kashif
pushed a commit
to kashif/transformers
that referenced
this pull request
Jun 1, 2026
* add a base model class * ensure BC via conversion mapping * auto classes * test updates * ensure BC for accessing attributes * simplify conversion mapping * convert modular * convert modular * apply to voxtral * convert modular * remove test_model_base_model_prefix overwrite * make * make * XXXModel class in doc * add GraniteSpeechPlusModel * tests now have a base_model_class * fix qwen2audio * class level base mappings * fix test_reverse_loading_mapping * fix * fix * nit * fix * deprec in 5.7 -> 5.15 * fix flaky test * fix flaky test * fix flaky test * remove forward_base_model_attrs * _supports_attention_backend in PretrainedModel * removed redundant get/set_input_embeddings * remove requires_grad_ handling * make fix-repo * fix voxtral realtime * update vibevoice_asr test * update test * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/glmasr/modeling_glmasr.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * make fix-repo --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
3 of 6 tasks
6 tasks done
pull Bot
pushed a commit
to j3din00b/transformers
that referenced
this pull request
Jun 8, 2026
* fix * fix * unnecessary and misleading
khushali9
pushed a commit
to khushali9/transformers
that referenced
this pull request
Jun 8, 2026
* add a base model class * ensure BC via conversion mapping * auto classes * test updates * ensure BC for accessing attributes * simplify conversion mapping * convert modular * convert modular * apply to voxtral * convert modular * remove test_model_base_model_prefix overwrite * make * make * XXXModel class in doc * add GraniteSpeechPlusModel * tests now have a base_model_class * fix qwen2audio * class level base mappings * fix test_reverse_loading_mapping * fix * fix * nit * fix * deprec in 5.7 -> 5.15 * fix flaky test * fix flaky test * fix flaky test * remove forward_base_model_attrs * _supports_attention_backend in PretrainedModel * removed redundant get/set_input_embeddings * remove requires_grad_ handling * make fix-repo * fix voxtral realtime * update vibevoice_asr test * update test * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/glmasr/modeling_glmasr.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * make fix-repo --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
khushali9
pushed a commit
to khushali9/transformers
that referenced
this pull request
Jun 8, 2026
* fix * fix * unnecessary and misleading
louzongzhi
pushed a commit
to louzongzhi/transformers
that referenced
this pull request
Jun 10, 2026
* fix * fix * unnecessary and misleading
louzongzhi
pushed a commit
to louzongzhi/transformers
that referenced
this pull request
Jun 10, 2026
* fix * fix * unnecessary and misleading
ArthurZucker
pushed a commit
that referenced
this pull request
Jun 11, 2026
4 tasks done
stevhliu
pushed a commit
to stevhliu/transformers
that referenced
this pull request
Jul 30, 2026
* add a base model class * ensure BC via conversion mapping * auto classes * test updates * ensure BC for accessing attributes * simplify conversion mapping * convert modular * convert modular * apply to voxtral * convert modular * remove test_model_base_model_prefix overwrite * make * make * XXXModel class in doc * add GraniteSpeechPlusModel * tests now have a base_model_class * fix qwen2audio * class level base mappings * fix test_reverse_loading_mapping * fix * fix * nit * fix * deprec in 5.7 -> 5.15 * fix flaky test * fix flaky test * fix flaky test * remove forward_base_model_attrs * _supports_attention_backend in PretrainedModel * removed redundant get/set_input_embeddings * remove requires_grad_ handling * make fix-repo * fix voxtral realtime * update vibevoice_asr test * update test * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/audioflamingo3/modular_audioflamingo3.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * Update src/transformers/models/glmasr/modeling_glmasr.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * make fix-repo --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
stevhliu
pushed a commit
to stevhliu/transformers
that referenced
this pull request
Jul 30, 2026
* fix * fix * unnecessary and misleading
This was referenced Sep 3, 2026
1 task done
sw005320
added a commit
to espnet/espnet
that referenced
this pull request
Sep 4, 2026
Dependabot's transformers 5.5.4 -> 5.10.1 bump (#6602) fails every unit-test job on one test, test_espnet_model_ps2st.py::test_espnet_model_inference. Two separate consequences of the same upstream refactor -- "[ALM] Add base model without head" (huggingface/transformers#45534), which splits an audio LM the way VLMs are already split. 1. `Qwen2AudioForConditionalGeneration.language_model` is gone. The text model now lives at `.model.language_model`, so reading bos/eos off it raised AttributeError. Rather than reach through the new path, take the ids from `config.get_text_config()`: that is the config `language_model` was built from in both versions, and `get_text_config()` is byte-identical in 5.5.4 and 5.10.1, so this does not need a version branch. 2. The dummy pytest model came out with mixed dtypes. The checkpoint config asks for bfloat16 and `AutoModel.from_config` honours it, but `lm_head` and `audio_tower` are now constructed on the outer model at the default dtype. In 5.5.4 the lm_head was inside `AutoModelForCausalLM` and came out bfloat16 with everything else; in 5.10.1 it is float32 while the hidden states feeding it are bfloat16, and the matmul refuses. Pin the shrunken test config to float32 so the whole dummy model is one dtype. Only the second fix is new behaviour, and only in `pytest_mode`; a real `from_pretrained` load gets its dtypes from the checkpoint. Verified against both versions, since the pin only moves once #6602 merges: transformers 5.5.4 before: pass after: pass transformers 5.10.1 before: fail after: pass Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This is motivated to simplify changes required for vLLM compatibility as seen in vLLM PR #39330
Fix a discrepancy in ALMs design compared to VLMs that for most of them don't have a base model class because the use the causal model for the text model directly, while Llava style (which is indeed more aligned with the lib philosophy) is rather:
XxModel: encoder + projector + language base model backbone
XxForConditionalGeneration: XxModel + lm_head
why do we actually have this discrepancy?
qwen2_audio was the first ALM in transformers, modelling reflects the status of llava when it was added
all the ALMs merged since then replicated this.
llava and VLMs evolved thanks to
base_model#41589get_decoder()for multimodal and delete redundant code 🔪 #42156🚨 Breaking changes
We don't fully ensure BC, this is breaking:
AutoModel.from_pretrained("Qwen/Qwen2-Audio-7B")now returnsQwen2AudioModel, notQwen2AudioForConditionalGeneration, some for other ALMs 🚨Qwen2AudioModel)model.language_modelonForContionalGeneationclass is not accessible anymore. Use model.get_decoder()how do we ensure BC (the more possible)
AutoModel(since this will be broken)models to which this applies
TODO