fix: skip qwen3_5_text checkpoint remap for nested VL language_model#45256
Closed
zozo123 wants to merge 1 commit intohuggingface:mainfrom
Closed
fix: skip qwen3_5_text checkpoint remap for nested VL language_model#45256zozo123 wants to merge 1 commit intohuggingface:mainfrom
zozo123 wants to merge 1 commit intohuggingface:mainfrom
Conversation
When saving a Qwen3.5-VL model with save_pretrained, the conversion_mapping incorrectly applied the qwen3_5_text weight remap to the nested language_model submodule. This caused save_pretrained to produce corrupted checkpoints for VL models. Skip the qwen3_5_text remap when the model class is not Qwen3_5TextForCausalLM (i.e. when it's a VL wrapper).
ec19bec to
4d4173e
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: qwen3_5 |
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=45256&sha=4d4173 |
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.
Summary
When saving a Qwen3.5 VL model via
save_pretrained, therevert_weight_conversionforqwen3_5_textreplaces a leadingmodel.segment. This wrongly matches keys that already start withmodel.language_model.on composite VL models, duplicating thelanguage_modelprefix in the saved safetensors keys.Fixes #45216
Changes
get_model_conversion_mapping(), detect when aqwen3_5_textsubmodule is the nestedmodel.language_modeltrunk in a VL modelrevert_weight_conversionqwen3_5_moe_textinside MoE VL models, apply onlyqwen2_moeconversionssave_pretraineddoes not produce keys with triple-nestedlanguage_modelsegmentsTesting
test_save_pretrained_no_triple_nested_language_model_prefixintest_modeling_qwen3_5.pyQwen3_5ForConditionalGenerationmodel and asserts no key containslanguage_model.language_model.language_modelBuilt autonomously by islo.dev