Repository navigation
Deprecate #36741 and map Causal to Conditional - #36917
Merged
Merged
Conversation
Contributor
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. When it is ready for review, please click the |
zucchini-nlp
marked this pull request as ready for review
March 24, 2025 08:38
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
ArthurZucker
left a comment
Collaborator
There was a problem hiding this comment.
TLDR of our internal thread:
- we need a AutoForAny, as today
AutoForCausalLMis a dumpster used to map anything - we cannot break, so for now it will remain this way
- we also want text only parts to be loadable only, similarly you would want to load only Image and Text -> ImageTextToText.
Let's patch this!
gante
reviewed
Mar 24, 2025
2 of 4 tasks
ArthurZucker
approved these changes
Mar 25, 2025
ArthurZucker
pushed a commit
that referenced
this pull request
Mar 25, 2025
zucchini-nlp
added a commit
to zucchini-nlp/transformers
that referenced
this pull request
May 14, 2025
…e#36917) * deprecate the prev fix * reword warning and update docs * reword warning * tests * dont bloat `get_text_config()`
soghomon-b
pushed a commit
to soghomon-b/transformers
that referenced
this pull request
Aug 24, 2025
…e#36917) * deprecate the prev fix * reword warning and update docs * reword warning * tests * dont bloat `get_text_config()`
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?
Fixes #36886, fixes #36926 and loading in SmolAgents (from feedback in internal slack)
NOTE: this is a temp fix. In long term we will converge under one Auto for all multimodals, which we don't have yet. As such we will keep
CausalLMas temporal dump for custom code users. 🔴 We will break this pattern in the near future and might enforce text-only models under this mappingAfter #36741, we unintentionally broke model loading for most remote code users, because many Vision/Audio/Omni LLMs on the hub use
CausalLMmapping withAutoTokenizer. This happens becauseAutoImageTextToTextis less visible, and also because we have no mapping for other modalities.This PR deprecates the previous fix and properly maps Gemma3 4B+ models to its
ConditionalGenerationclass which aligns with info in model card. As discussed internally, all vision-audio-multimodal models will converge underAutoModelForCausalLMin the future to maintain consistency and stop adding new mapping for each new modality.Why? All Audio LMs are already in causal mapping due to the lack of
AutoAudioTextToTextorAutoAudioToTextmappings. Vision LMs have also been inconsistently mapped under CausalLMConsequences: No breaking changes for users, including those using remote code. A warning is raised only if a model has both full config and text config mapped in
CausalLMwhich is a super rare case. (gemma-3 was exception)Edge cases: Other models like
llava-1.5cannot load anymore underAutoModelForCausalLMafter this PR, but checkpoint keys won’t match anyway + we never got user issues. This was an existing issue, not introduced by this PR. It might be resolved by a bigger refactor for vLLM after adding base models for all VLMs and correctbase-prefix-keysI verified that Gemma3 case works as expected, without raising warnings (I just changed mapping class). The only difference from the previous fix is that vision tower is loaded as well, which might affect advanced users who manipulated configs or access model layers manually.