* tests: import_fixes drift detectors (HARD GATE on Core matrix)
Ports zoo PR #637's drift-detector pattern to unsloth as a new
test file + Core matrix step.
Background
unsloth/import_fixes.py is a 1932-line catalog of hand-rolled
patches for upstream regressions: protobuf MessageFactory drift,
datasets 4.4.x recursion, TRL tuple-vs-bool _*_available caching,
transformers PreTrainedModel.enable_input_require_grads source
pattern flip, triton CompiledKernel num_ctas missing, peft
weight-converter ctor compat, torch/torchvision pairing, vllm
guided_decoding params, etc. Today each fix runs unconditionally
at unsloth import; that's defensively correct but it means:
a fix becoming a no-op (upstream silently fixed itself) is
invisible.
a fix becoming needed-but-broken (upstream drifted in a new
way the workaround doesn't match) only surfaces as a
downstream crash.
tests/test_import_fixes_drift.py (18 tests)
One drift detector per fix_* / patch_* function in import_fixes.py.
Each test asserts the HEALTHY upstream shape absent the regression.
When the pathology is currently ACTIVE, fires
pytest.fail("DRIFT DETECTED: <fix function> needed because
<observation>") -- NEVER pytest.skip. CI must go RED so the
maintainer triages on the next PR.
First run on the current install surfaces 3 active drifts:
peft.utils.transformers_weight_conversion unimportable
(transformers.conversion_mapping missing) -- patch_peft_
weight_converter_compatibility will silently no-op.
triton 3.5.1 CompiledKernel lacks num_ctas + cluster_dims --
fix_triton_compiled_kernel_missing_attrs is live-needed.
vllm exposes only StructuredOutputsParams, not
GuidedDecodingParams -- fix_vllm_guided_decoding_params
is live-needed.
CI wiring (.github/workflows/consolidated-tests-ci.yml)
New step `import_fixes drift detectors (18 tests, HARD GATE)`
added to the Core matrix BEFORE the Bucket-A tests, so the matrix
cell fails fast on a real upstream regression. No
continue-on-error: a drift detection MUST go red.
This mirrors the same change just landed on
unslothai/unsloth-zoo#637 (commit ff5a3d8). Same fail-loud-on-drift
semantic; same set of fix functions covered; same 1:1 mapping
between test + import_fixes.py source-of-truth function.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* chore: trim verbose docstrings in import_fixes drift detectors
Strictly comment / docstring trims. AST-verified comment-only.
* Module header: 36 lines -> 7 lines.
* Per-test docstring: collapse each 7-15 line prose block to a 1-3
line lead naming the import_fixes.py function + line range plus
the one-sentence why; pytest.fail messages stay verbatim so a
red CI cell still names the upstream regression.
* Helper docstrings (_safe_version, _is_custom_torch_build): drop.
* Inline narrative comments inside test bodies: drop.
* Section dividers and licence header: untouched.
Net: 700 -> 537 lines, zero behaviour changes.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>