unsloth/tests/sh
Daniel Han 62912e1069 Add AMD ROCm detection to install.sh with validation and shell tests
Extend get_torch_index_url() to detect AMD ROCm when nvidia-smi is not
found. The detection chain tries, in order: amd-smi, /opt/rocm version
file, hipconfig, dpkg-query (rocm-core), and rpm (rocm-core).

Key design decisions:
- NVIDIA always takes precedence (ROCm detection only runs when
  nvidia-smi is absent)
- ROCm 7.2+ is capped to rocm7.1 index because torch 2.11.0 (the only
  version on the rocm7.2 index) exceeds the current upper bound <2.11.0
- macOS returns CPU immediately before any ROCm check
- A validation guard rejects malformed _rocm_tag values (e.g. "rocm."
  from garbled amd-smi output with empty version fields)
- Debian epoch prefixes (e.g. "2:6.2.0") are stripped from dpkg-query
  output before parsing

Also adds ROCm status messaging (CPU-only hint mentions AMD, ROCm
detected message), and installs bitsandbytes for AMD when a ROCm
PyTorch index is selected.

Shell tests expanded from 8 to 23 cases covering all CUDA tiers, ROCm
versions 6.0-8.0, CUDA+ROCm precedence, malformed amd-smi output
(empty version, "N/A", trailing text), and CUDA regression checks.
2026-03-31 08:34:05 +00:00
..
test_get_torch_index_url.sh Add AMD ROCm detection to install.sh with validation and shell tests 2026-03-31 08:34:05 +00:00
test_mac_intel_compat.sh tests: add no-torch / Intel Mac test suite (#4646) 2026-03-27 02:33:45 -07:00