Skip to content

[generation] Encode multimodal data only once#45783

Open
zucchini-nlp wants to merge 35 commits into
huggingface:mainfrom
zucchini-nlp:multimodal-encode-generation
Open

[generation] Encode multimodal data only once#45783
zucchini-nlp wants to merge 35 commits into
huggingface:mainfrom
zucchini-nlp:multimodal-encode-generation

Conversation

@zucchini-nlp

@zucchini-nlp zucchini-nlp commented May 5, 2026

Copy link
Copy Markdown
Member

CI

What does this PR do?

As per title, moves multimodal encoding out of the loop so it happens only once and on un-expanded pixels. For example, in assisted generation we used to encode twice (once in assistant and once in target model), or in beam search we used to expand all pixel by x num_beams times. This is very inefficient, especially in models where vision encoder requires huge memory like qwen-series (usually extremely long sequence lengths)

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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
Copy Markdown
Member Author

run-slow: aria, aya_vision, blip_2, chameleon, cohere2_vision, deepseek_vl, deepseek_vl_hybrid, emu3, ernie4_5_vl_moe, fast_vlm, florence2, fuyu, gemma3, gemma3n, gemma4, glm46v

@huggingface huggingface deleted a comment from github-actions Bot May 6, 2026
@huggingface huggingface deleted a comment from github-actions Bot May 6, 2026
@huggingface huggingface deleted a comment from github-actions Bot May 6, 2026
@zucchini-nlp

Copy link
Copy Markdown
Member Author

run-slow: aria, aya_vision, blip_2, chameleon, cohere2_vision, deepseek_vl, deepseek_vl_hybrid, emu3, ernie4_5_vl_moe, fast_vlm, florence2, fuyu, gemma3, gemma3n, gemma4, glm46v, qwen2_vl, mllama, llava, llava_next_video

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Workflow Run ⚙️

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

models: ["models/aria", "models/aya_vision", "models/blip_2", "models/chameleon", "models/cohere2_vision", "models/deepseek_vl", "models/deepseek_vl_hybrid", "models/emu3", "models/ernie4_5_vl_moe", "models/fast_vlm", "models/florence2", "models/fuyu", "models/gemma3", "models/gemma3n", "models/gemma4", "models/glm46v", "models/llava", "models/llava_next_video", "models/mllama", "models/qwen2_vl"]
quantizations: []

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

CI Results

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 123df352 workflow commit (merge commit)
PR d2bf8497 branch commit (from PR)
main 4c2daf7f base commit (on main)

Model CI Report

7 new failed tests from this PR 😭

  • emu3:
    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 (❌ ⟹ ❌)

  • gemma4:
    tests/models/gemma4/test_modeling_gemma4.py::Gemma4IntegrationTest::test_export_text_only (❌ ⟹ ❌)

  • llava:
    tests/models/llava/test_modeling_llava.py::LlavaForConditionalGenerationIntegrationTest::test_pixtral (❌ ⟹ ❌)
    tests/models/llava/test_modeling_llava.py::LlavaForConditionalGenerationIntegrationTest::test_pixtral_4bit (❌ ⟹ ❌)
    tests/models/llava/test_modeling_llava.py::LlavaForConditionalGenerationIntegrationTest::test_pixtral_batched (❌ ⟹ ❌)

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

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

run-slow: aria, aya_vision, blip_2, chameleon, cohere2_vision, deepseek_vl, deepseek_vl_hybrid, emu3, ernie4_5_vl_moe, exaone4_5, fast_vlm, florence2, fuyu, gemma3, gemma3n, gemma4

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 29938792022:1
Result: failure | Jobs: 2 | Tests: 6 | Failures: 2 | Duration: 1m 32s

Code quality check failed: test jobs were skipped. Fix the code quality issues and push again to run tests.

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