Skip to content

[serge] Fix 2 integration tests for model qwen3_vl_moe failing with OOM, raising OutOfMemoryError (other (2)) - #50148

Open
sergereview[bot] wants to merge 1 commit into
mainfrom
serge/fix/itf-6c6e81a67f31-90ceebb9
Open

sergereview[bot] wants to merge 1 commit into
mainfrom
serge/fix/itf-6c6e81a67f31-90ceebb9

Conversation

@sergereview

@sergereview sergereview Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🤗 Transformers CI

Original CI failure

  • Failure group: 2 integration tests for model qwen3_vl_moefailing withOOM, raising OutOfMemoryError (other (2))
  • tests/models/qwen3_vl_moe/test_modeling_qwen3_vl_moe.py::Qwen3VLMoeIntegrationTest::test_small_model_integration_test_expand — retained memory (fixable): needed 768 MiB, PyTorch already held 20.86 GiB of 22.30 GiB
CI traceback — tests/models/qwen3_vl_moe/test_modeling_qwen3_vl_moe.py::Qwen3VLMoeIntegrationTest::test_small_model_integration_test_expand
(line 1287)  torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 768.00 MiB. GPU 1 has a total capacity of 22.30 GiB of which 358.69 MiB is free. Process 292590 has 21.95 GiB memory in use. Of the allocated memory 20.86 GiB is allocated by PyTorch, and 813.35 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://docs.pytorch.org/docs/stable/notes/cuda.html#optimizing-memory-usage-with-pytorch-cuda-alloc-conf)

Where to watch it:

Both tests OOM inside from_pretrained: the Transpose conversion of experts.gate_up_proj needs 768 MiB while device_map="auto" has already filled GPU 1 to ~20.9 GiB of 22.3 GiB. The card is full of the model being loaded, not of leftovers — the class already uses MemoryCleanupMixin and every model is a local, so there is nothing retained to free.

The fix follows the pattern already used for the other 30B MoE integration tests (#48776, glm4v_moe, phimoe, qwen3_omni_moe): load through a get_model() helper with a 70% per-GPU max_memory cap and an offload_folder, so the conversion temporary has room. No expected values change.

Relates to #50143


✅ Verified on GPU

serge ran the targeted @slow test(s) on a GPU runner and opened this PR only after they passed with this patch. Each targeted test was run 5× on both the pre-patch and patched trees to rule out flakiness — the result held on every run.

Possibly related

Existing issues/PRs mentioning test_small_model_integration_test_expand (keyword match — not verified to share a root cause):

  • #49301 — [Qwen3VLMoe] Update expected text in test_small_model_integration_test_expand (PR, closed, updated 2026-10-08)
  • #48594 — MRoPE continued (PR, closed, updated 2026-09-09)
  • #48105 — 🚨 Vision (2d/3d) rotary embeddings (PR, closed, updated 2026-09-04)
  • #48171 — Fix stale expected values in integration tests (cuda sm_86 / Aug04 regressions) (PR, closed, updated 2026-08-21)
  • #47096 — Exportable kimi (PR, closed, updated 2026-07-31)

This change was produced automatically by serge from a CI failure report. The patch was generated by an LLM and applied by serge; review before merging.

serge v0.1.0 · model: deepseek-ai/DeepSeek-V4.1-Flash-1017:together · 15 LLM turns · 23 tool calls · 133.1s · 409032 in / 72783 out tokens

… `OOM`, raising `OutOfMemoryError` (other (2))
@sergereview
sergereview Bot marked this pull request as ready for review October 30, 2026 00:54
@github-actions
github-actions Bot requested a review from ydshieh October 30, 2026 00:54
@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.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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

run-slow: qwen3_vl_moe

This branch has not been deployed

No deployments
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.

1 participant