Repository navigation
Bump installer floor to 2026.5.1 - #5284
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the minimum version requirement for the unsloth package from 2026.4.8 to 2026.5.1 across the PowerShell and Shell installation scripts. The review feedback highlights several opportunities for improvement, including centralizing the version string into a variable to enhance maintainability and ensuring consistency across all installation paths, as some standard paths were missed. Additionally, the reviewer identified unreachable code blocks and recommended using dynamic package name variables instead of hardcoded strings to better support existing script flags.
| # No-torch: install unsloth + unsloth-zoo with --no-deps, then | ||
| # runtime deps (typer, safetensors, transformers, etc.) with --no-deps. | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.4.8" unsloth-zoo } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --no-deps --reinstall-package unsloth --reinstall-package unsloth-zoo "unsloth>=2026.5.1" unsloth-zoo } |
There was a problem hiding this comment.
The version floor 2026.5.1 is hardcoded in multiple locations across the installer scripts. To improve maintainability and ensure consistency in future updates, consider centralizing this value into a single variable at the top of the script.
References
- Centralize recurring constants or logic to ensure consistency and simplify maintenance.
| } | ||
| } elseif ($StudioLocalInstall) { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.4.8" unsloth-zoo } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package unsloth "unsloth>=2026.5.1" unsloth-zoo } |
There was a problem hiding this comment.
The version floor is updated here for local installs but appears to be missing from the standard install path at line 1127. This inconsistency might allow fresh standard installs to pull older versions. Additionally, using the $PackageName variable instead of the hardcoded unsloth string would better support the --package flag functionality.
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython --upgrade-package $PackageName "$PackageName>=2026.5.1" unsloth-zoo }
| substep "installing unsloth (this may take a few minutes)..." | ||
| if ($StudioLocalInstall) { | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython unsloth-zoo "unsloth>=2026.4.8" --torch-backend=auto } | ||
| $baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython unsloth-zoo "unsloth>=2026.5.1" --torch-backend=auto } |
There was a problem hiding this comment.
This else block appears to be unreachable because Get-TorchIndexUrl (called at line 1019) always returns a non-empty string (defaulting to CPU or CUDA 12.6), causing the elseif ($TorchIndexUrl) condition at line 1099 to always evaluate to true. This fallback logic is effectively dead code.
$baseInstallExit = Invoke-InstallCommand { uv pip install --python $VenvPython unsloth-zoo "$PackageName>=2026.5.1" --torch-backend=auto }
| run_install_cmd "install unsloth (migrated no-torch)" uv pip install --python "$_VENV_PY" --no-deps \ | ||
| --reinstall-package unsloth --reinstall-package unsloth-zoo \ | ||
| "unsloth>=2026.4.8" unsloth-zoo | ||
| "unsloth>=2026.5.1" unsloth-zoo |
There was a problem hiding this comment.
The version floor 2026.5.1 is repeated many times across both installer scripts. Centralizing this into a variable would simplify future version bumps and reduce the risk of missing an instance during updates.
References
- Centralize recurring constants or logic to ensure consistency and simplify maintenance.
| elif [ "$STUDIO_LOCAL_INSTALL" = true ]; then | ||
| run_install_cmd "install unsloth (local)" uv pip install --python "$_VENV_PY" \ | ||
| --upgrade-package unsloth "unsloth>=2026.4.8" unsloth-zoo | ||
| --upgrade-package unsloth "unsloth>=2026.5.1" unsloth-zoo |
There was a problem hiding this comment.
The version floor is missing from the primary install path at line 1689, which may result in fresh standard installs pulling older versions if the solver finds a valid dependency set. Additionally, using $PACKAGE_NAME instead of hardcoding unsloth ensures the --package flag is correctly respected in this path.
| --upgrade-package unsloth "unsloth>=2026.5.1" unsloth-zoo | |
| --upgrade-package "$PACKAGE_NAME" "$PACKAGE_NAME>=2026.5.1" unsloth-zoo |
| substep "installing unsloth (this may take a few minutes)..." | ||
| if [ "$STUDIO_LOCAL_INSTALL" = true ]; then | ||
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.4.8" --torch-backend=auto | ||
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.5.1" --torch-backend=auto |
There was a problem hiding this comment.
This else block is currently unreachable because get_torch_index_url (line 1430) always returns a value, satisfying the elif [ -n "$TORCH_INDEX_URL" ] condition at line 1526. This fallback logic is dead code and will not be executed under current conditions.
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" unsloth-zoo "unsloth>=2026.5.1" --torch-backend=auto | |
| run_install_cmd "install unsloth (auto torch backend)" uv pip install --python "$_VENV_PY" unsloth-zoo "$PACKAGE_NAME>=2026.5.1" --torch-backend=auto |
The AMD arch-specific index (repo.amd.com/rocm/whl/gfx120X-all/ and gfx1151/) publishes torch wheels from 2.7.1 through 2.11.0. Without a version floor pip can resolve to torch 2.10.0+rocm7.12 on RDNA 4 (gfx120X) or torch 2.10.0+rocm7.1 on Strix (gfx1151/gfx1150), both of which have a null-pointer crash in torch._C._grouped_mm (TheRock issues unslothai#5284 / unslothai#3284). torch 2.11.0+rocm7.13 contains the fix. Add $ROCmTorchFloor alongside $ROCmIndexUrl: set to torch>=2.11.0 for the two affected arch families, null for all others. Wire it into the uv pip install call so the broken wheels are never selected.
…(gfx1201) (#7292) * studio: extend the _grouped_mm null-kernel guard to Linux ROCm RDNA4 torch._grouped_mm has a null HIP kernel on RDNA4 (gfx1200/gfx1201) at ROCm <= 7.12 (fixed in 7.13; ROCm/TheRock #5284). The existing guard that registers a Python mm/bmm fallback was win32-only, so Linux gfx1201 (e.g. R9700 Pro on Ubuntu) hits the null kernel -> illegal instruction during training. Extract the fallback registration into a module-level helper (_install_grouped_mm_cpu_fallback) and add a Linux branch that installs it, gated on gfx1200/gfx1201 AND HIP < 7.13 so NVIDIA/CUDA and every non-RDNA4 AMD arch are untouched, and it is a no-op on fixed runtimes. The Windows path now calls the same helper with identical behavior. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Resolve HIP version from torch.__version__ when version.hip is unset for PR #7292 AMD SDK / Radeon ROCm wheels leave torch.version.hip empty and encode the version only in torch.__version__ (e.g. +rocm7.12). The Linux gfx120X guard parsed version.hip only, so those affected installs skipped the fallback and still hit the null _grouped_mm kernel. Mirror the Windows parse: version.hip, then the embedded rocmX.Y, then assume affected unless a post-fix rocmsdk wheel. * Scan all GPUs and add RDNA4 name fallback for _grouped_mm guard in PR #7292 * worker.py: tighten gfx120X Linux guard comments (no code change) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
main grew its own Windows AMD ROCm install path while this branch sat open, and it is a strict superset of what this branch built. main routes Windows AMD torch through the per-arch pip indexes at repo.amd.com/rocm/whl/<family>/ (install.ps1 $archFamilyMap, setup.ps1 $ROCmIndexUrl, install_python_stack.py _windows_rocm_index_url), which serve cp310 through cp313 win_amd64 wheels up to torch 2.11.0+rocm7.13.0 and resolve the ROCm runtime (rocm, rocm-sdk-core, rocm-sdk-libraries-<gfx>) from the same index. This branch's route pinned torch 2.9.x from repo.radeon.com/rocm/windows/, cp312 only, and hand-installed four SDK artefacts because rocm-sdk-libraries-custom is absent from PyPI. Against main that is a regression on three counts: it locks AMD hosts to Python 3.12, it installs exactly the torch <2.11 wheels main blocks on gfx115x/gfx120x for the torch._C._grouped_mm null-pointer bug (TheRock #5284, #3284), and it skips bitsandbytes on Windows, which main now installs via _install_bnb_windows_rocm(). So every conflicting hunk in install.ps1, studio/setup.ps1 and studio/install_python_stack.py resolves to main. One hunk from this branch is not superseded and is kept: the Windows nvidia-smi.exe fallback paths in _has_usable_nvidia_gpu(). main only probes PATH there, while install.ps1 and setup.ps1 both probe %ProgramFiles%\NVIDIA Corporation\NVSMI and %SystemRoot%\System32 as well. That gap matters on an AMD iGPU plus NVIDIA dGPU laptop whose PATH misses nvidia-smi: the host reads as NVIDIA-free and gets routed to the ROCm wheels. Grafted onto main's function, below its CUDA_VISIBLE_DEVICES guard.
…00) to AMD's gfx120X wheels (#11935) * Route RDNA 4 to AMD's gfx120X-all wheels on Linux below ROCm 7.13 The generic pytorch.org ROCm wheels up to rocm7.2 ship the null HIP _grouped_mm kernel on gfx1200/gfx1201 (TheRock #5284), so the trainer swaps in a slow Python fallback whenever torch.version.hip is below 7.13. A ROCm 7.14 host is capped to rocm7.2 and always lands there. AMD's gfx120X-all index serves torch 2.11.0+rocm7.13.0 for cp310-cp314, the same coverage the Strix reroute already relies on, and install.ps1 already routes Windows RDNA 4 there. Extend the Strix reroute to gfx1200/gfx1201 in install.sh and install_python_stack.py: - install.sh rewrites the leaf to gfx120x-all so the rocm6.4 floor block below cannot undo it; the floor target flag is still set for the migrated venv repair. - install_python_stack.py shares one set for the reroute and the pending check, so a venv already on the AMD build is left alone. - Explicit UNSLOTH_TORCH_INDEX_URL / _FAMILY pins and the gfx906 override are unchanged. Tests move the RDNA 4 expectations from rocm6.4 to gfx120x-all, retarget cases that used gfx120X as a plain generic arch, and add the new route with gfx1100 and rocm7.13 controls. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments in RDNA 4 AMD arch index routing * Reinstall a migrated sub-7.13 wheel when torch is routed to an AMD per-arch index * Also reinstall a migrated 7.13 wheel built for another AMD family * Keep RDNA 4 on the generic wheels in a Python 3.9 venv, which gfx120X-all does not serve * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the migrated repair test from reading an AMD host's own rocm package With no family given, the stubbed venv left importlib.metadata.requires unpatched, so on a ROCm host it read the real rocm-sdk-libraries-gfx1151 and reinstalled where the case expects no change. * Pin the ROCm repair test helpers to Linux x86_64 _ensure_rocm_torch() is a no-op on macOS and aarch64, so on those runners the pip mocks were never called and the new RDNA 4 routing tests failed. * Trim comments in the RDNA 4 routing change * Drop comments that restate the RDNA 4 test names * Expect RDNA 4 to install from the AMD index when the ROCm version is unreadable --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…00) to AMD's gfx120X wheels (unslothai#11935) * Route RDNA 4 to AMD's gfx120X-all wheels on Linux below ROCm 7.13 The generic pytorch.org ROCm wheels up to rocm7.2 ship the null HIP _grouped_mm kernel on gfx1200/gfx1201 (TheRock unslothai#5284), so the trainer swaps in a slow Python fallback whenever torch.version.hip is below 7.13. A ROCm 7.14 host is capped to rocm7.2 and always lands there. AMD's gfx120X-all index serves torch 2.11.0+rocm7.13.0 for cp310-cp314, the same coverage the Strix reroute already relies on, and install.ps1 already routes Windows RDNA 4 there. Extend the Strix reroute to gfx1200/gfx1201 in install.sh and install_python_stack.py: - install.sh rewrites the leaf to gfx120x-all so the rocm6.4 floor block below cannot undo it; the floor target flag is still set for the migrated venv repair. - install_python_stack.py shares one set for the reroute and the pending check, so a venv already on the AMD build is left alone. - Explicit UNSLOTH_TORCH_INDEX_URL / _FAMILY pins and the gfx906 override are unchanged. Tests move the RDNA 4 expectations from rocm6.4 to gfx120x-all, retarget cases that used gfx120X as a plain generic arch, and add the new route with gfx1100 and rocm7.13 controls. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments in RDNA 4 AMD arch index routing * Reinstall a migrated sub-7.13 wheel when torch is routed to an AMD per-arch index * Also reinstall a migrated 7.13 wheel built for another AMD family * Keep RDNA 4 on the generic wheels in a Python 3.9 venv, which gfx120X-all does not serve * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the migrated repair test from reading an AMD host's own rocm package With no family given, the stubbed venv left importlib.metadata.requires unpatched, so on a ROCm host it read the real rocm-sdk-libraries-gfx1151 and reinstalled where the case expects no change. * Pin the ROCm repair test helpers to Linux x86_64 _ensure_rocm_torch() is a no-op on macOS and aarch64, so on those runners the pip mocks were never called and the new RDNA 4 routing tests failed. * Trim comments in the RDNA 4 routing change * Drop comments that restate the RDNA 4 test names * Expect RDNA 4 to install from the AMD index when the ROCm version is unreadable --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
unsloth>=install floor ininstall.shandinstall.ps1from2026.4.8to2026.5.1so fresh installs pull the just-released PyPI version.Test plan
bash install.shon a clean Linux box installsunsloth==2026.5.1.install.ps1on Windows installsunsloth==2026.5.1.--studio-local-installand the--torch-backend=autopaths still resolve.