Skip to content

test(coverage): fix the stale MoE sweep and the last nvcc gate (#4981) - #4998

Merged
Qubitium merged 1 commit into
mainfrom
root/test-coverage-gates-4981
Nov 17, 2026
Merged

Qubitium merged 1 commit into
mainfrom
root/test-coverage-gates-4981

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

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_linear case in the exhaustive MoE sweep, and the last over-strict nvcc gate. 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: extract select_model_definition(model_type, config) from check_and_get_model_definition(). The kimi_linear native-vs-K3 dispatch moved verbatim; the llava guard and the return value are unchanged.
  • tests/module_tree/test_moe_expert_coverage.py:
    • resolve the definition through select_model_definition() instead of MODEL_MAP[model_type];
    • defuse through the loader's _convert_model_with_defuser() instead of bare defuser.convert_model(), so defuser_generic_experts definitions (kimi_linear, mimo_v2_flash) get Defuser's generic replacement pass that the loader runs;
    • select the sweep with @pytest.mark.meta_coverage instead of GPTQMODEL_META_COVERAGE=1;
    • skip a model whose fused 3-D expert projections the installed Defuser cannot split, citing the loader's DEFUSER_MIN_VERSION, instead of reporting it as definition drift.
  • tests/conftest.py: add meta_coverage to _OPT_IN_MARKERS.
  • gptqmodel/utils/cpp.py: new public cuda_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 on cuda_toolkit_available() instead of shutil.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 definition check_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 @ d5dde1357 is the rebase base.

# every command: CUDA_HOME=/usr/local/cuda PYTHONPATH=<worktree> GPTQ_BYPASS_SAFETY_CHECKS=1 \
#   LOGBAR_ANIMATION=0 HF_HUB_OFFLINE=1 python /tmp/root-rt.py <paths> -q -o addopts= -o log_cli=false
Item unmodified main this PR
tests/module_tree/test_moe_expert_coverage.py sweep only 4 failed, 102 passed, 18 skipped, 11 xfailed 0 failed, 104 passed, 20 skipped, 11 xfailed
test_machete_jit.py::test_machete_cuda_smoke_build_only_with_forced_arch_override, nvcc off PATH, CUDA_HOME unset SKIPPED "nvcc required" 1 passed (266 s)
tests/module_tree/ (whole dir) 13 failed, 1743 passed, 812 skipped, 3 xfailed, 9 errors 13 failed, 1743 passed, 812 skipped, 3 xfailed, 9 errors — identical node sets (diffed)
test_lfm3_support.py + test_docs_contract_refs.py + EXL3 suites — 70 passed, 6 skipped

Sweep 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 splits mlp.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 own after_defuser_conversion error). 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 are glm5_next flash-tree nodes and other environment limits; the node lists are byte-identical before and after.

ruff check is clean on all 9 changed files.

Model Support / Module Plan

Definition selection refactor only; no MODEL_MAP entry, module tree, or fusion config changed. select_model_definition() is the existing MODEL_MAP_CASEFOLD lookup plus the existing kimi_linear -> KimiLinearNativeQModel dispatch, moved verbatim. tests/module_tree/test_kimi_linear_native_tree.py and the rest of tests/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_CASEFOLD lookup, then the kimi_linear config-field dispatch; the llava guard still runs inside check_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

  • Reviewed this PR.
  • Matches existing project structure and conventions (opt-in markers already exist for checkpoint_recovery; cpp._nvcc_path() is the existing resolution).
  • No monkeypatching added to production code; the test calls the loader's real conversion path.
  • Surface kept minimal: one new helper in cpp.py, one extracted selector in auto.py, test-only edits elsewhere.
  • Regressions checked against unmodified main (identical tests/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

#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
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