unsloth/tests
Daniel Han 4e1cb4affa
install.sh: route Strix to the AMD arch index on rocm7.2 (#7264) + PCI detection hint (#7293)
* install.sh: route Strix (gfx1151/gfx1150) to the AMD arch index on rocm7.2, add PCI hint

Two Linux install fixes for AMD Strix Halo / Strix Point:

1. #7264: Strix reverts to rocm7.2. Modern ROCm (7.3+) caps to the generic
   rocm7.2 index and the Radeon repo can be unavailable, so gfx1151/gfx1150
   landed on a non-arch-specific build (torch 2.11+rocm7.2) instead of
   repo.amd.com/rocm/whl/gfx<arch> (torch 2.11+rocm7.13, AMD's real Strix
   fixes). The reroute to that arch index only fired on rocm7.1; broaden it to
   rocm7.2 too. Only acts when a gfx1151/gfx1150 is actually detected, so other
   arches on rocm7.2 pass through unchanged.

2. Rows about Strix not detected -> CPU-only: when no GPU is detected but an AMD
   display GPU is on the PCI bus, print a targeted hint (ROCm kernel stack /
   /dev/kfd missing) instead of only the generic docs pointer. Purely
   additive diagnostic; does not change the torch index decision.

* Address review on PR #7293: gate PCI hint on ROCm-detection failure, fix test marker, use read builtin

- Only show the 'ROCm cannot see the GPU' hint when _has_amd_rocm_gpu fails;
  a detected-but-too-old ROCm (rocminfo works, wheels need 6.0+) has its own path.
- Update test_previous_torch_pin.sh to the stable 'Strix Halo / Strix Point:'
  marker after the heading reworded (the old grep broke the ordering assert).
- _amd_gpu_present_via_pci: read builtin instead of spawning cat twice per
  device, and guard /sys/bus/pci/devices existence.

* install.sh: reroute Strix on any generic index older than the arch build

Generalize the Strix reroute from the hardcoded rocm7.1/rocm7.2 match to a
version compare against the arch index's own build (rocm7.13):

- backwards: rocm6.0-6.4 and rocm7.0 now reroute (were silently missed)
- forwards: any future intermediate rocm7.x below 7.13 reroutes; rocm7.13+
  is left alone so a generic index that already carries the fix is not
  downgraded to the arch build

_rocm_index_below does an integer major.minor compare (so rocm7.2 < rocm7.13);
non-rocm, arch (gfx), and unparseable URLs return false, so NVIDIA/CPU and the
arch index itself are untouched. Reroute still fires only for gfx1150/gfx1151.

* install.sh: tighten _amd_gpu_present_via_pci comment (no code change)

* install.sh: match the index leaf in the Strix version reroute (#7293 review)

Address two review points on the rocm-version reroute:

- Parse the final path segment (_torch_index_leaf) instead of grepping the whole
  URL. A custom mirror whose base path holds its own rocm token (e.g.
  .../rocm7.13/cache/rocm7.2) previously matched the base and skipped the reroute;
  now it compares the leaf (rocm7.2) like the nearby index-family logic. Renamed
  the helper to _rocm_leaf_below and switched the case selector to $_torch_index_leaf.
- Replace the stale test_strix_override_only_fires_on_rocm71 (which passed by
  matching the new rocm7.13 comment) with an executed test that runs _rocm_leaf_below
  and asserts rocm6.0-7.12 reroute while rocm7.13+/gfx/cu leaves do not.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* install.sh: keep gfx probes non-fatal under set -e (#7293 review)

The Strix reroute now matches every rocm* index, not just rocm7.1, so its gfx
detection runs on all AMD installs. Each `_gfx_all=$(rocminfo|amd-smi | grep -oE
gfx...)` returns 1 when grep finds no match, which under set -euo pipefail aborts
the installer before the next fallback runs (e.g. rocminfo present but emitting no
gfx token). Append `|| true` to the three probes, matching the display block that
already guards this. Add an executed regression test (shimmed rocminfo/amd-smi)
that fails if any probe becomes fatal again.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-21 19:40:59 -07:00
..
notebooks Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
python install: let UNSLOTH_TORCH_INDEX_FAMILY / _URL override CUDA wheel detection (#6692) 2026-07-20 00:58:52 -07:00
qlora Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports (#6079) 2026-06-08 04:24:13 -07:00
saving Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
security Harden desktop release token permissions (#7172) 2026-07-16 05:01:48 -07:00
sh install.sh: route Strix to the AMD arch index on rocm7.2 (#7264) + PCI detection hint (#7293) 2026-07-21 19:40:59 -07:00
studio install.sh: route Strix to the AMD arch index on rocm7.2 (#7264) + PCI detection hint (#7293) 2026-07-21 19:40:59 -07:00
studio_setup_ps1 Make Visual Studio + CMake optional on Windows (prebuilt llama.cpp needs no build tools) (#6499) 2026-06-22 01:11:09 -07:00
utils Experimental: correct varlen sample packing for hybrid linear-attention models (#7249) 2026-07-20 00:57:02 -07:00
version_compat test(version-compat): keep GRPO fake-run logits finite on CPU (#7247) 2026-07-19 04:54:17 -07:00
vllm_compat Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
__init__.py Qwen 3, Bug Fixes (#2445) 2025-04-30 22:38:39 -07:00
_zoo_aggressive_cuda_spoof.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
_zoo_rocm_spoof.py Add RDNA 2/3/4 ROCm routing tests via a CPU-only torch spoof (#6935) 2026-07-07 04:41:37 -07:00
conftest.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
run_all.sh install: let UNSLOTH_TORCH_INDEX_FAMILY / _URL override CUDA wheel detection (#6692) 2026-07-20 00:58:52 -07:00
test_attention_implementation.py fix(gpt-oss): prefer flex attention over sdpa (#5701) 2026-05-22 08:38:38 -07:00
test_attn_impl_honor_explicit.py Honor an explicit sdpa or flex_attention request when flash is disabled (#6847) 2026-07-06 05:45:45 -07:00
test_bad_mappings_redirect.py Fix BAD_MAPPINGS not redirecting the -unsloth-bnb-4bit dynamic quants (#6949) 2026-07-08 17:37:44 -03:00
test_callback_signature_drift.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_cli_export_unpacking.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_enforce_kwargs_spacing.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_fast_gemv_dispatch.py Fix fast inference crash on compressed-tensors FP8 models (#7025) 2026-07-09 04:10:59 -07:00
test_fast_generate_slow_guard.py fast_generate: clear error for vLLM-style inputs when fast_inference=False (#6786) 2026-07-03 08:16:32 -07:00
test_finetune_last_n_layers.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_fp8_device_context.py Guard FP8 Triton launches with tensor device context (#6888) 2026-07-08 18:32:51 -03:00
test_fp8_restore_dropped_scale.py Restore dropped FP8 weight_scale_inv tensors on load (#6978) 2026-07-09 06:44:44 -07:00
test_fp8_tiny_e8m0.py Handle odd shapes and non-float scales in FP8BlockQuantLinear (#6848) 2026-07-06 05:44:55 -07:00
test_fused_ce_not_return_dict_logits.py fix: use EMPTY_LOGITS on the fused-CE not-return_dict path (#2068) (#6482) 2026-06-23 01:26:55 -07:00
test_gemma4_chat_template.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_gemma_2b_mapper_key.py Fix duplicate unsloth/gemma-2b-bnb-4bit mapper key routing the base 4bit repo to the instruct model (#6891) 2026-07-08 17:40:39 -03:00
test_generate_kwarg_gate.py Fix gpt-oss offload_embedding and generate() kwargs, and guard offload_embedding on tied/vLLM models (#6774) 2026-07-01 22:39:00 -07:00
test_get_model_name.py Fix DeepScaleR-1.5B mapper entry pointing its 16bit repo at DeepHermes-3-8B (#7088) 2026-07-14 17:56:12 -03:00
test_gradient_checkpointing_restore.py Fix TrainingArguments silently disabling unsloth gradient checkpointing (#6829) 2026-07-03 16:35:02 +01:00
test_ignored_tokenizer_casing.py Match IGNORED_TOKENIZER_NAMES case-insensitively (#6620) 2026-06-23 19:40:50 -03:00
test_import_fixes_drift.py fix: keep LoRA reloads working with PEFT 0.19 (#6748) 2026-06-30 20:26:57 +01:00
test_installer_skip_autostart.py fix(install): fail non-tauri installer errors (#7123) 2026-07-15 04:37:03 -07:00
test_installer_unsloth_version.py Installer: report the installed Unsloth version (#7265) 2026-07-21 03:48:49 -07:00
test_loader_glob_skip.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_missing_torchvision_vlm.py Fix misleading 'only for image models' error for Qwen3-VL when torchvision is missing (#6525) 2026-06-23 01:28:09 -07:00
test_model_registry.py fix(registry): don't register deepseek models at import time (#7227) 2026-07-19 03:37:23 -07:00
test_moe_lora_targets.py Scope MoE expert LoRA detection to actual MLP projection targets (#6849) 2026-07-06 05:45:06 -07:00
test_multi_image_grpo_chunking.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_nvfp4_quant_load.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_offline_loading_helpers.py Fix offline checkpoint load/export: "tokenizer is weirdly not loaded" (#6554) 2026-06-25 23:16:53 -07:00
test_offload_embedding_hooks.py Fix gpt-oss offload_embedding and generate() kwargs, and guard offload_embedding on tied/vLLM models (#6774) 2026-07-01 22:39:00 -07:00
test_offload_tied_guard.py Fix gpt-oss offload_embedding and generate() kwargs, and guard offload_embedding on tied/vLLM models (#6774) 2026-07-01 22:39:00 -07:00
test_peft_tensor_parallel_compat.py fix: keep LoRA reloads working with PEFT 0.19 (#6748) 2026-06-30 20:26:57 +01:00
test_peft_weight_converter_compat.py Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports (#6079) 2026-06-08 04:24:13 -07:00
test_prefetch_snapshot_scope.py Auto Xet to HTTP download fallback in from_pretrained; share Studio's fallback via unsloth_zoo (#6638) 2026-07-06 05:13:25 -07:00
test_pretrain_compile_reset.py Add regression tests for the stray-forward compile-cache reset (#6569) 2026-06-22 07:22:47 -07:00
test_public_api_surface.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_raw_text.py fix(dataprep): skip .jsonl lines that are valid JSON but not objects (#7195) 2026-07-18 05:54:50 -07:00
test_resolve_model_class.py Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports (#6079) 2026-06-08 04:24:13 -07:00
test_studio_install_workspace_guard.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_studio_root_resilience.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_studio_shutdown_thread_wait.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_synthetic_chunk_data.py Fix SyntheticDataKit.chunk_data emitting chunks over max_tokens (#7073) 2026-07-12 05:06:11 -07:00
test_tool_mask_zoo_compat.py Formatting: ruff line-length 100, kwarg-spacing passes, drop blank after short local imports (#6079) 2026-06-08 04:24:13 -07:00
test_uninitialized_position_ids.py Load DeepSeek-OCR and other VLMs that register AutoModel in auto_map (#6421) 2026-06-18 07:03:43 -07:00
test_video_path_validation.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_vllm_broken_detection.py Fix fast_inference crash on ABI-broken vLLM: probe compiled extensions, not just import vllm (#6621) 2026-06-26 22:43:36 -07:00
test_windows_rocm_bnb_version.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00