Repository navigation
Make tests/utils runnable again and cover test_packing.py in CI - #7642
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6cb15419f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @pytest.mark.skipif( | ||
| not torch.cuda.is_available(), reason = "builds a real 4bit model on an accelerator" | ||
| ) |
There was a problem hiding this comment.
Keep accelerator packing tests enabled on XPU
On an Intel XPU host, torch.cuda.is_available() is false, so pytest skips this test before its explicit torch.xpu.is_available() branch can select the XPU device; the identical decorator on test_packing_sdpa has the same problem. This removes both packing checks from XPU validation even though the setup supports XPU, so the skip condition should require that neither CUDA nor XPU is available.
Useful? React with 👍 / 👎.
| pytest.importorskip( | ||
| "torchao.quantization.qat", | ||
| reason = "install or upgrade with: pip install 'torchao>=0.15.0'", | ||
| ) |
There was a problem hiding this comment.
Skip QAT tests only when TorchAO is absent
With the workflow-pinned pytest 9.0.3, importorskip catches any ImportError raised while importing this installed submodule, not just a missing TorchAO package. If an installed TorchAO build is incompatible with the current PyTorch version or has a broken dependency, the entire QAT suite is therefore reported as skipped instead of exposing the compatibility failure; check that the optional package is absent first, then import the QAT API normally so failures from an installed package remain test failures.
Useful? React with 👍 / 👎.
…lpers (#7645) #7188 added three bare exits to studio/setup.sh and three to studio/setup.ps1 for the explicit-Vulkan paths. Bare exits skip setup_fail / Exit-SetupFailure, so the [TAURI:ERROR] line that #7529 added never reaches Studio desktop and a Vulkan install failure shows up there with no actionable context. tests/sh/test_tauri_retry_failure_context.sh already asserts that each setup script has exactly one explicit exit and that it lives inside the helper. That assertion was failing, but the failure was invisible: Backend CI skips the Shell installer tests step whenever the auto-discovered pytest step fails first, and it had been failing on an unrelated encoding assertion until #7642. Exit codes are unchanged: setup_fail 1 and Exit-SetupFailure both exit 1, and the Tauri line is still emitted only when UNSLOTH_TAURI_MODE is set.
tests/utils/test_packing.pyandtest_qat.pyare not run by any workflow, and both had drifted to the point where they fail on a correctly provisioned checkout. This makes them pass again and wires the packing suite into CI so it cannot drift back.Before, on a clean
mainwith the deps CI installs: 25 failed, 99 passed. After: 121 passed, 4 skipped.Fake configs need
to_dict().get_transformers_model_type()resolves the config throughto_dict(), whichSimpleNamespacedoes not have, so 19 tests died onTypeError: Unsloth: Cannot determine model type for config file: namespace(...). There was already a local_WarnConfigsubclass in this file working around exactly this for two tests. Promoted it to a shared_FakeConfigused by all nine fake configs and removed the duplicate.torchao is optional, so skip rather than fail. The module caught
ImportError, printed a hint, and then every one of the 4 tests failed on the missing name. Replaced withpytest.importorskip("torchao.quantization.qat").Two tests need an accelerator.
test_enable_sample_packing_trl_collatorandtest_packing_sdpabuild a real model and raiseRuntimeError: No CUDA GPUs are availableon a CPU runner, so they get askipif. Verified both ways: CPU-only gives 49 passed / 2 skipped, with GPUs 51 passed.CI. Added
tests/utils/test_packing.pyto the Bucket-A CPU job and the collection sanity check. That job already installsbitsandbytes>=0.45, which is what the suite needs.test_qat.pyis left out on purpose since torchao is not installed there and it would only ever report skips.No production code changes:
tests/and one workflow list.