Repository navigation
test(coverage): fix the stale MoE sweep and the last nvcc gate (#4981) - #4998
Merged
Merged
Conversation
#4991 unskipped the EXL3 tests from #4981. This is the rest of that issue. The exhaustive MoE sweep resolved `MODEL_MAP["kimi_linear"]` (the legacy AttnRes/K3 tree) for every config, but the loader dispatches native `KimiLinearForCausalLM` to `KimiLinearNativeQModel`. That definition sets `defuser_generic_experts`, so the loader splits its fused 3-D experts through Defuser's *generic* replacement pass, which bare `defuser.convert_model()` never runs: 768 native `mlp.experts.N.{gate,up,down}_proj` specs never resolved. `mimo_v2_flash` (the same contract) failed the same way. The sweep now resolves the definition with the new `models.auto.select_model_definition()` and defuses through the loader's own `_convert_model_with_defuser()`, and it is selected by `-m meta_coverage` instead of `GPTQMODEL_META_COVERAGE=1`, matching the other opt-in suites. A model whose fused experts the installed Defuser cannot split is skipped with the loader's own `DEFUSER_MIN_VERSION` instead of being reported as definition drift. `test_machete_jit.py` gated its sm_90a build-only node on `nvcc` being on `PATH`, but torch resolves `CUDA_HOME` to /usr/local/cuda even when nvcc is not on `PATH`, so the node skipped on hosts where the extension builds and runs. `cpp.cuda_toolkit_available()` now mirrors `_nvcc_path()` (CUDA_HOME, then PATH, then the conventional install) and the node runs: 266 s on this host with nvcc off PATH and CUDA_HOME unset. ninja is still required separately, and a genuinely broken toolkit still fails the build instead of hiding behind a skip. `tests/test_lfm3_support.py` and the three `tests/models/test_lfm3*.py` files pointed at `/monster/data/models/`, while the other 288 test files use `/monster/data/model/`, so the LFM3 checkpoints never resolved on the lab host. Refs #4981
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.
Summary
Follow-up to #4981 (closed by #4991, which unskipped the EXL3 tests). This PR covers the two parts of that issue that #4991 left alone: the stale
kimi_linearcase in the exhaustive MoE sweep, and the last over-strictnvccgate. Plus the LFM3 checkpoint path convention from the same issue's item 4.No kernel math, model registry entry, or quantization path changes.
What Changed
gptqmodel/models/auto.py: extractselect_model_definition(model_type, config)fromcheck_and_get_model_definition(). Thekimi_linearnative-vs-K3 dispatch moved verbatim; the llava guard and the return value are unchanged.tests/module_tree/test_moe_expert_coverage.py:select_model_definition()instead ofMODEL_MAP[model_type];_convert_model_with_defuser()instead of baredefuser.convert_model(), sodefuser_generic_expertsdefinitions (kimi_linear,mimo_v2_flash) get Defuser's generic replacement pass that the loader runs;@pytest.mark.meta_coverageinstead ofGPTQMODEL_META_COVERAGE=1;DEFUSER_MIN_VERSION, instead of reporting it as definition drift.tests/conftest.py: addmeta_coverageto_OPT_IN_MARKERS.gptqmodel/utils/cpp.py: new publiccuda_toolkit_available()=_nvcc_path() is not None(CUDA_HOME -> PATH ->/usr/local/cuda), the same resolution the JIT extension builder uses.tests/test_machete_jit.py: the sm_90a build-only node gates oncuda_toolkit_available()instead ofshutil.which("nvcc"); ninja is still required separately.tests/test_lfm3_support.py,tests/models/test_lfm3.py,tests/models/test_lfm3_omni.py,tests/models/test_lfm3_vl.py:/monster/data/models/->/monster/data/model/.select_model_definition()returns the same definitioncheck_and_get_model_definition()returned before, for every model type; it exists so a test can resolve the loader's choice without a checkpoint.Tests
Host: 8x PG506 (sm_80), torch 2.15.0.dev20260928+cu130, transformers 5.20.2, defuser 0.0.25. Baseline = unmodified
origin/main@56f87e9f5(before #4991) in a detached worktree;origin/main@d5dde1357is the rebase base.maintests/module_tree/test_moe_expert_coverage.pysweep onlytest_machete_jit.py::test_machete_cuda_smoke_build_only_with_forced_arch_override, nvcc off PATH,CUDA_HOMEunsettests/module_tree/(whole dir)test_lfm3_support.py+test_docs_contract_refs.py+ EXL3 suitesSweep detail (this host, defuser 0.0.25 vs the loader's
DEFUSER_MIN_VERSION = 0.0.31):kimi_linear,mimo_v2_flash: failed -> passed (the generic-experts pass splitsmlp.experts.N.{gate,up,down}_proj).glm5_next,granitemoe_swa: failed -> skipped with "installed defuser 0.0.25 leaves N fused 3-D expert projection(s) unsplit; the loader requires defuser>=0.0.31" (glm5_next instead surfaces the loader's ownafter_defuser_conversionerror). The issue's own numbers (108 passed / 16 skipped / 1 failed) came from a host with a newer defuser.The 22 pre-existing
tests/module_tree/failures/errors areglm5_nextflash-tree nodes and other environment limits; the node lists are byte-identical before and after.ruff checkis clean on all 9 changed files.Model Support / Module Plan
Definition selection refactor only; no
MODEL_MAPentry, module tree, or fusion config changed.select_model_definition()is the existingMODEL_MAP_CASEFOLDlookup plus the existingkimi_linear->KimiLinearNativeQModeldispatch, moved verbatim.tests/module_tree/test_kimi_linear_native_tree.pyand the rest oftests/module_tree/are unchanged (identical results above).Model test node IDs and results:
tests/module_tree/test_moe_expert_coverage.py(fixed six/three-model checks plus the marker-selected sweep) — results above.AWQ onboarding safety
Not applicable: no model onboarding, no AWQ grouping/search/replay/fold change.
Logic Flow Documentation
Not applicable: the selection order is unchanged (
MODEL_MAP_CASEFOLDlookup, then thekimi_linearconfig-field dispatch; the llava guard still runs insidecheck_and_get_model_definition()before returning). This PR extracts those lines into a named function so the meta-coverage test calls the same code path as the loader; it does not add, remove, or reorder a decision.Review Requirements
checkpoint_recovery;cpp._nvcc_path()is the existing resolution).cpp.py, one extracted selector inauto.py, test-only edits elsewhere.main(identicaltests/module_tree/node sets).Kernel Accuracy Requirements
Not applicable: no kernel math changed. The machete gate only decides whether a test runs; it cannot alter results.
Notes
pytest tests/module_tree/test_moe_expert_coverage.py -m meta_coverage;GPTQMODEL_META_COVERAGE=1is no longer read (nothing in CI used it).cuda_source_build_available()(headers + ninja) would skip more than it enables.cuda_toolkit_available()is deliberately weaker: it requires thenvccfile the builder itself looks for, and ninja is still checked separately, so it only un-skips hosts where the build can actually start.ggufpackage a test dependency (417 CUDA / 91 ROCm GGUF-oracle tests skip without it) is a packaging decision for the GGUF owners, andtests/test_quant_linear_release_4847.py::test_compiled_dequantize_does_not_pin_the_moduleoverlaps [MEM] #4871 (fix of #4847) incomplete: model.optimize() still leaves the whole model in a reference cycle (compiled bound forward stored on the instance); VRAM kept until gc.collect() #4937/[TEST] Suite triage at 3867c82af (RTX 4090 + R9700): 7 tests left red by #4871, #4829, #4837, #4835, #4810, #4930, #4856 (stale doubles/oracles; library behaves as intended) #4969.