Skip to content

Commit 20ac036

Browse files
author
serge[bot]
committed
[serge] Fix 6 integration tests for model qwen3_vl_moe failing with other, raising RuntimeError (other (6))
1 parent 2f170da commit 20ac036

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎tests/models/qwen3_vl_moe/test_modeling_qwen3_vl_moe.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from transformers.testing_utils import (
3030
Expectations,
3131
backend_device_count,
32+
cleanup,
3233
get_cpu_ram_total_gib,
3334
require_flash_attn,
3435
require_torch,
@@ -310,12 +311,19 @@ def setUpClass(cls):
310311
# Assigned here rather than in the class body: `MemoryCleanupMixin` snapshots the class body and
311312
# protects it from teardown, so a checkpoint parked on a class-body `model` is never released.
312313
cls.model = None
313-
cls.offload_dir = None
314+
cls.model_key = None
315+
cls.offload_dir = tempfile.TemporaryDirectory()
314316

315317
@classmethod
316318
def get_model(cls, **kwargs):
317-
if cls.model is None:
318-
cls.offload_dir = tempfile.TemporaryDirectory()
319+
# Keyed on the load kwargs: the tests ask for different dtypes and attention implementations, and
320+
# serving them all the first-loaded checkpoint would silently change what they measure.
321+
key = tuple(sorted((name, str(value)) for name, value in kwargs.items()))
322+
if cls.model is None or cls.model_key != key:
323+
# One checkpoint at a time: each is ~62 GiB of bf16 weights, so two do not fit on the runner.
324+
cls.model = None
325+
cleanup(torch_device, gc_collect=True)
326+
cls.model_key = key
319327
# `device_map="auto"` fills each GPU to capacity, leaving no room for the
320328
# ~768 MiB temporary the expert gate/up transpose allocates while loading; a
321329
# 70% per-GPU max_memory cap reserves that headroom.

0 commit comments

Comments
 (0)