Skip to content

test(models): gate flash-attn eval args and pin QQQ test to fp16 (#4398) - #4433

Merged
Qubitium merged 1 commit into
mainfrom
fix/models-suite-triage
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/models-suite-triage

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

tests/models integration suite failures at def6e61 that are test-harness bugs rather than product regressions:

  1. test_llama3_2_qqq sets LOAD_BACKEND=BACKEND.QQQ but leaves TORCH_DTYPE="auto"; Llama-3.2-1B is bf16 and QQQLinear only supports fp16, so post-quant validation always raised.
  2. Twelve per-task evalution_model_args hard-coded attn_implementation: "paged|flash_attention_2", bypassing the harness USE_FLASH_ATTN / is_flash_attn_2_available() gate and crashing with ImportError after quantization on hosts without flash-attn.

Addresses items 1-2 of #4398.

What Changed

  • tests/models/test_llama3_2_qqq.py: pin TORCH_DTYPE=torch.float16 and the evaluation dtype to fp16, preserving real BACKEND.QQQ coverage.
  • tests/models/model_test.py: add ModelTest.resolve_attn_implementation(), which keeps paged|flash_attention_2 when flash-attn is importable and falls back to paged|sdpa otherwise.
  • Route the affected per-task eval args and the ParoQuant helper defaults through it (test_llama3_2, swordfish, dynamic-skip-layer, multi-vs-single-gpu, qwen3_6_moe, qwen3_8b_fp8, cohere_compass, ling_2_6_flash, nemotron_omni, paroquant helpers).
  • CPU unit tests for the helper in tests/test_model_test_helpers.py.

Items 3-5 (stale slow-mode baselines, silently-skipping tests, batch_size="auto" OOM thrash) are report-only in the issue; they need new baselines/perf work and are not changed here.

Tests

PYTHONPATH=/root/work-4398 /root/venv/bin/python -m pytest tests/test_model_test_helpers.py -q
20 passed, 1 failed
# failure: test_load_dataset_falls_back_when_datasets_import_failed — pre-existing on origin/main
# (reproduced in a pristine worktree at 810edf3); unrelated to this change.
/root/venv/bin/python -m ruff check <changed files>
All checks passed!

Real RTX 5090 tests/models runs were not executed in this container (no GPU / no flash-attn).

Logic Flow Documentation

New resolve_attn_implementation() decision: explicit non-flash request is preserved, flash_attention_2 downgrades to sdpa only when flash-attn is missing. Pinned by the new unit tests; no docs page.

Review Requirements

  • Reviewed; harness-only change, no product behavior change.

Item 1: test_llama3_2_qqq now pins TORCH_DTYPE and its evalution dtype to
float16 because QQQLinear only supports FP16, preserving BACKEND.QQQ
coverage instead of switching to the portable QQQ_TORCH kernel.

Item 2: add ModelTest.resolve_attn_implementation(), which keeps
paged|flash_attention_2 when flash-attn is importable and falls back to
paged|sdpa otherwise, and route the per-task evalution_model_args (and the
ParoQuant helper defaults) through it. test_multi_vs_single_gpu and
test_deci were already gated/no-flash and are unchanged.

Adds CPU unit tests for the new helper.
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