Skip to content

Move VLM conversions to the main mapping#44627

Merged
Cyrilvallez merged 20 commits intohuggingface:mainfrom
zucchini-nlp:move-vlm-conversion-to-main-mapping
Mar 17, 2026
Merged

Move VLM conversions to the main mapping#44627
Cyrilvallez merged 20 commits intohuggingface:mainfrom
zucchini-nlp:move-vlm-conversion-to-main-mapping

Conversation

@zucchini-nlp
Copy link
Member

@zucchini-nlp zucchini-nlp commented Mar 12, 2026

What does this PR do?

The diff in revert mapping is needed, otherwise we get failures in a few models, see https://app.circleci.com/pipelines/github/huggingface/transformers/167425/workflows/fa96efe5-f810-408e-bafd-de03b7e881aa/jobs/2208432/tests

The literal dot is a nice feat to have in general, we actually mean a literal dot in all of the patterns where . is used. The being and end patterns are needed when reverse mapping from ^model.language_model to model but the state dict has other keys such as pre_layer_proj_model. So it is reversed incorrectly if not marked explicitly as $ or ^

@HuggingFaceDocBuilderDev

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.

@zucchini-nlp
Copy link
Member Author

run-slow: llava, qwen2_vl, paligemma, gemma3

@github-actions
Copy link
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/gemma3", "models/llava", "models/paligemma", "models/qwen2_vl"]
quantizations: []

@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 520c0913 workflow commit (merge commit)
PR a4392ef9 branch commit (from PR)
main dc4016ff base commit (on main)

✅ No failing test specific to this PR 🎉 👏 !

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@Cyrilvallez
Copy link
Member

run-slow: colmodernvbert got_ocr2 paligemma qwen3_5_moe llava_next_video fuyu qwen2_5_vl cohere2_vision lfm2_vl llava_next ovis2 mllama shieldgemma2 qwen3_vl_moe glm4v_moe glm46v aria gemma3 llava llava_onevision mistral3 sam3_tracker fast_vlm florence2 colpali glm4v emu3 aya_vision qwen3_vl vipllava paddleocr_vl lighton_ocr video_llava glm_ocr colqwen2 ernie4_5_vl_moe video_llama_3 glm_image qwen3_5 internvl sam3 gemma3n sam3_tracker_video qwen2_vl perception_lm

@github-actions
Copy link
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/aria", "models/aya_vision", "models/cohere2_vision", "models/colmodernvbert", "models/colpali", "models/colqwen2", "models/emu3", "models/ernie4_5_vl_moe", "models/fast_vlm", "models/florence2", "models/fuyu", "models/gemma3", "models/gemma3n", "models/glm46v", "models/glm4v", "models/glm4v_moe", "models/glm_image", "models/glm_ocr", "models/got_ocr2", "models/internvl", "models/lfm2_vl", "models/lighton_ocr", "models/llava", "models/llava_next", "models/llava_next_video", "models/llava_onevision", "models/mistral3", "models/mllama", "models/ovis2", "models/paddleocr_vl", "models/paligemma", "models/perception_lm", "models/qwen2_5_vl", "models/qwen2_vl", "models/qwen3_5", "models/qwen3_5_moe", "models/qwen3_vl", "models/qwen3_vl_moe", "models/sam3", "models/sam3_tracker", "models/sam3_tracker_video", "models/shieldgemma2", "models/video_llama_3", "models/video_llava", "models/vipllava"]
quantizations: []

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, just pushed a few changes to simplify the loading logic a bit!
LGTM otherwise, let's just wait for the slow tests as touching the mappings can silently break all the real-world weights!

Comment on lines -328 to -335
"timm_wrapper": [
# Simply add the prefix `timm_model`
# TODO: Would be probably much cleaner with a `add_prefix` argument in WeightRenaming
WeightRenaming(
source_patterns=r"(.+)",
target_patterns=r"timm_model.\1",
)
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you really really sure about this one? The base_model_prefix really covers it completely even when used as submodel etc?

@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN ba12425d workflow commit (merge commit)
PR d2fb5024 branch commit (from PR)
main 036340b7 base commit (on main)

⚠️ Model CI failed to report results

The test failure analysis could not be completed. Please check the workflow run for details.

@zucchini-nlp
Copy link
Member Author

run-slow: colmodernvbert, got_ocr2, paligemma, qwen2_5_vl, cohere2_vision, lfm2_vl, llava, shieldgemma2, sam3_tracker, paddleocr_vl, colpali

@github-actions
Copy link
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/cohere2_vision", "models/colmodernvbert", "models/colpali", "models/got_ocr2", "models/lfm2_vl", "models/llava", "models/paddleocr_vl", "models/paligemma", "models/qwen2_5_vl", "models/sam3_tracker", "models/shieldgemma2"]
quantizations: []

@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 9610fd00 workflow commit (merge commit)
PR 47c2f837 branch commit (from PR)
main 0832773d base commit (on main)

✅ No failing test specific to this PR 🎉 👏 !

@zucchini-nlp
Copy link
Member Author

run-slow: aria, aya_vision, cohere2_vision, colmodernvbert, colpali, colqwen2, emu3, ernie4_5_vl_moe, fast_vlm, florence2, fuyu, gemma3, gemma3n, glm46v, glm4v, glm4v_moe

@github-actions
Copy link
Contributor

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs:

models: ["models/aria", "models/aya_vision", "models/cohere2_vision", "models/colmodernvbert", "models/colpali", "models/colqwen2", "models/emu3", "models/ernie4_5_vl_moe", "models/fast_vlm", "models/florence2", "models/fuyu", "models/gemma3", "models/gemma3n", "models/glm46v", "models/glm4v", "models/glm4v_moe"]
quantizations: []

@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 6f52db6b workflow commit (merge commit)
PR 3acd5ac1 branch commit (from PR)
main 0832773d base commit (on main)

Model CI Report

5 new failed tests from this PR 😭

  • colqwen2:
    tests/models/colqwen2/test_modeling_colqwen2.py::ColQwen2ForRetrievalModelTest::test_reverse_loading_mapping (✅ ⟹ ❌)

  • emu3:
    tests/models/emu3/test_modeling_emu3.py::Emu3IntegrationTest::test_model_generate_images (❌ ⟹ ❌)
    tests/models/emu3/test_modeling_emu3.py::Emu3IntegrationTest::test_model_generation (❌ ⟹ ❌)
    tests/models/emu3/test_modeling_emu3.py::Emu3IntegrationTest::test_model_generation_batched (❌ ⟹ ❌)
    tests/models/emu3/test_modeling_emu3.py::Emu3IntegrationTest::test_model_generation_multi_image (❌ ⟹ ❌)

@zucchini-nlp
Copy link
Member Author

Emu3 fails on main as well because of OOM, and locally the loading works without missing keys

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright thanks! Let's keep an eye on tomorrow's slow CI run though to be sure!

@Cyrilvallez Cyrilvallez merged commit bbe251a into huggingface:main Mar 17, 2026
11 of 26 checks passed
@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: aria, aya_vision, cohere2_vision, colmodernvbert, colpali, colqwen2, emu3, ernie4_5_vl_moe, fast_vlm, florence2, fuyu, gemma3, gemma3n, glm46v, glm4v, glm4v_moe

@github-actions
Copy link
Contributor

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=44627&sha=90f253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants