fix(utils): resolve test model paths lazily - #1568
Open
EazyReal wants to merge 1 commit into
Open
Conversation
Importing shared testing utilities should not download every configured model before pytest can apply GPU and slow-test skips. Preserve the registry mapping interface while resolving and caching only requested keys. Key changes: - replace eager model path registries with lazy mappings - defer VLM model lookup to fixture setup after skip evaluation - cover offline import, collection, and per-key caching behavior
EazyReal
requested review from
fishcrap,
garrett4wade and
sitabulaixizawaluduo
as code owners
July 31, 2026 02:08
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Contributor
Author
|
This fixes an eager-resolution bug in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Importing
tests.utilsimportsareal.utils.testing_utils, whose module-level model registries previously resolved every configured path immediately. On machines without the shared model directory, importing or collecting a CPU test could therefore callsnapshot_downloadfor unrelated dense and 30–35B MoE fixtures before pytest evaluated GPU and slow-test skips.Keep the existing read-only mapping interface while resolving and caching only requested model keys. VLM parameterization now passes the mapping and key to an indirect fixture, so model resolution happens only after pytest skip evaluation.
Related Issue
No existing issue found. This is a narrow import-side-effect regression with executable coverage included here.
Type of Change
Verification
HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 python -m pytest -q tests/test_testing_utils.py tests/experimental/openai/test_concat_prompt.py— 10 passedtests/test_megatron_engine_vlm_distributed.py— 14 tests collected with no cache writespre-commit run --all-files— passedGPU and distributed VLM execution were not run because the test machine has no GPU. The affected invariant is import and collection behavior before those tests execute.
Checklist
pre-commit run --all-files)mainBreaking Change Details (if applicable):
None.
Additional Context
The dense, MoE, and combined registries retain their existing key lookup behavior for
__getitem__and iteration. Iteration and length inspection remain download-free; the first lookup of a key resolves it once and caches the result. BecauseMapping.get()is implemented in terms of__getitem__, calling.get()on these registries now also triggers lazy resolution (and a possible download) on first access, rather than returning an already-resolved value the way it did when these were plain dicts.