Skip to content

Commit da11fe5

Browse files
HanFaclaude
andcommitted
test(mm-routing): predownload the pinned GLM revision
Review follow-up on 97296c2. The shared predownload fetched the checkpoint's default branch before it turned on HF_HUB_OFFLINE. Once that branch moves past the pinned revision, a clean runner would not find the pinned snapshot. The model mark now takes revision=: pytest_collection_modifyitems records it as repo_id@revision and download_models fetches that revision. The GLM module passes its pin and only looks the snapshot up in the cache. In the multi-image test, AC_cold must now also match more blocks than the text-only prompt fills. The old [A repeat - 1, A repeat] bound accepted zero when the A repeat matched a single block, as it does at GB200's 4352-token vLLM block, so losing the first image's cached blocks would have passed. _send now returns a RequestObservation and checks the worker's expansion against the router's block count before returning. That removes the tuple unpacking and the per-test expansion calls. Signed-off-by: Fang Han <fangh@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 97296c2 commit da11fe5

2 files changed

Lines changed: 169 additions & 196 deletions

File tree

‎tests/conftest.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ def download_models(model_list=None, ignore_weights=False):
464464
465465
Args:
466466
model_list: List of model IDs to download. If None, downloads TEST_MODELS.
467+
An ID written as ``repo_id@revision`` downloads that revision instead
468+
of the default branch.
467469
ignore_weights: If True, skips downloading model weight files. Default is False.
468470
"""
469471
if model_list is None:
@@ -490,6 +492,7 @@ def download_models(model_list=None, ignore_weights=False):
490492

491493
failures = []
492494
for model_id in model_list:
495+
repo_id, _, revision = model_id.partition("@")
493496
logging.info(
494497
f"Pre-downloading {'model (no weights)' if ignore_weights else 'model'}: {model_id}"
495498
)
@@ -507,13 +510,15 @@ def download_models(model_list=None, ignore_weights=False):
507510

508511
# Download everything except weight files
509512
snapshot_download(
510-
repo_id=model_id,
513+
repo_id=repo_id,
514+
revision=revision or None,
511515
ignore_patterns=weight_patterns,
512516
)
513517
else:
514518
# Download the full model snapshot (includes all files)
515519
snapshot_download(
516-
repo_id=model_id,
520+
repo_id=repo_id,
521+
revision=revision or None,
517522
)
518523
logging.info(f"Successfully pre-downloaded: {model_id}")
519524

@@ -787,8 +792,11 @@ def pytest_collection_modifyitems(config, items):
787792
):
788793
continue
789794
for model_mark in item.iter_markers("model"):
795+
# model(repo_id, revision=...) pins the download, so a test that
796+
# loads a fixed revision finds it cached once HF_HUB_OFFLINE is set.
797+
revision = model_mark.kwargs.get("revision")
790798
for repo_id in model_mark.args:
791-
models_to_download.add(repo_id)
799+
models_to_download.add(f"{repo_id}@{revision}" if revision else repo_id)
792800

793801
# Store models to download in pytest config for fixtures to access
794802
if models_to_download:

0 commit comments

Comments
 (0)