🚨 [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
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
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 |
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>
6 tasks
6 tasks
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
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