Repository navigation
Studio: torch 2.13 for new Windows x64 cu130 Python 3.13 installs, existing installs keep their torch - #13263
Conversation
…isting installs keep their torch Windows port of #12150. install.ps1 gives a new install torch 2.13 when the torch index is cu130, the machine and the venv interpreter are both x64, the venv is CPython 3.13, and the newest unsloth on PyPI admits torch 2.13 (no on UV_OFFLINE, UV_EXCLUDE_NEWER*, a configured uv index, or any fetch/parse failure; UNSLOTH_PYPI_JSON_URL points the check elsewhere). That is the only Windows route the prebuilt-wheels-cu13 kernel wheels can serve. Existing installs keep their release: on that route the preservation window widens to <2.15, every earlier layout (occupied venv, legacy .venv with or without a working interpreter, CWD-relative venv) counts as an existing home, and UNSLOTH_TORCH_UPGRADE=1 opts in. An upgrade with the route closed keeps a resident release above the default range instead of moving it down. A kept torch 2.12+ now pairs with torchaudio 2.11 (the last release) in install.ps1 and in setup.ps1's kept-release paths. setup.ps1 picks the triton-windows minor from the installed torch (2.13 -> 3.7, 2.14 -> 3.8, otherwise <3.7; Windows on ARM unchanged). install_python_stack.py's repair specs and core-update torch freeze cover native Windows x64 as well as Linux.
…nterpreter cannot answer
…he resident torch
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…install, migrated venv, CWD venv without python.exe; bounded fallback; UV_OFFLINE through Test-UvEnvFlag
|
@codex review |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c28b265bca
ℹ️ 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".
| $baseInstallExit = Invoke-InstallCommandRetry -Label "install unsloth (migrated)" { & $script:UvExe pip install --python $VenvPython --reinstall-package unsloth --reinstall-package unsloth-zoo "$_unslothReleaseInstallSpec" "unsloth-zoo>=2026.10.3" } | ||
| # As install.sh: freeze the trio for this with-deps resolve, then keep the release for the | ||
| # flavor repair below, which would otherwise reinstall the default range. | ||
| $script:TorchOverridesFile = New-UnslothTorchOverridesFile -PythonExe $VenvPython |
There was a problem hiding this comment.
Honor upgrade requests while migrating legacy environments
When UNSLOTH_TORCH_UPGRADE=1 migrates a healthy legacy .venv or CWD-relative environment on the new Windows x64/cu130/Python 3.13 route, this unconditional override freezes the old torch trio during the core install, while the later Get-PreviousTorchPin deliberately returns null for an upgrade. The migrated branch never calls Resolve-Cu130TorchRoute, and setup.ps1 subsequently installs bare, already-satisfied package names unless another condition forces reinstall, so a resident 2.11 installation remains on 2.11 instead of opting into the intended 2.13 default; if a reinstall is forced, it may instead select the newest unconstrained release. Skip this preservation for an explicit upgrade and route the migrated environment through the same 2.13 selection used by other existing layouts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Leaving this one as is. The legacy migration in install.sh freezes torch the same way (its migrated branch always runs under _UNSLOTH_TORCH_OVERRIDES, whatever UNSLOTH_TORCH_UPGRADE says), and before this PR the Windows migrated branch never went through the 2.13 route either, so nothing that used to upgrade stops upgrading. The migration only fires once, when the old ~/.unsloth/studio/.venv layout exists and the new one does not. The next install with UNSLOTH_TORCH_UPGRADE=1 runs on the migrated venv as a normal existing install, and that path takes the upgrade.
…lease resident torch
…de space-free; match --package unsloth case-insensitively in install.sh
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
… the resident torch on unforced setup runs
… within the index's published range
…ulated x64 venvs on Windows on ARM too
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
New Studio installs on Windows x64 with an NVIDIA driver on the cu130 route and Python 3.13 now get torch 2.13, the same route #12150 added for Linux. That is the torch the new
win_amd64flash-attn 2.8.4, causal-conv1d 1.7.0 and mamba-ssm 2.3.2.post1 wheels onprebuilt-wheels-cu13are built for. Existing installs keep the torch they have.What changes
New installs (
install.ps1): the route is taken only when all of these hold:cu130win-amd64unsloth(a--packageother than unsloth keeps the default, since the check reads unsloth's metadata;install.shgets the same one-line gate)UV_EXCLUDE_NEWER*, a configured uv index, or any fetch or parse failure;UNSLOTH_PYPI_JSON_URLcan point it at a mirror. Same reasoning as Studio: torch 2.13 for new Linux cu130 Python 3.13 installs, existing installs keep their torch #12150:studio updatere-resolves under the installed release's own cap.It installs
torch>=2.13,<2.14,torchvision>=0.28,<0.29and torchaudio 2.11. Every other route is unchanged: cu126, cu128, CPU, ROCm, XPU, Windows on ARM, and Python 3.11 / 3.12.Existing installs
$script:ExistingInstallis decided before any venv is moved aside, for every earlier layout: the occupied new-layout venv, a legacy.venvwith or without a working interpreter, and the CWD-relative~/unsloth_studiovenv.torch\version.pyon disk. Without that a resident 2.13 or 2.14 would fall back to the<2.12default on a plain re-run.torch>=2.4,<2.15, so any 2.4 to 2.14 release stays.UNSLOTH_TORCH_UPGRADE=1(what the Desktop manual repair already sets on every platform) opts in to the new default; with the route closed it keeps a resident 2.13 / 2.14 instead of moving it down.install.ps1falls back to the old default, never to 2.13, and that fallback is the bounded trio, never a baretorch..venvthat is migrated into the new layout keeps its torch: the migratedunslothreinstall runs under the same torch overrides as the other paths and hands the kept release tosetup.ps1, likeinstall.sh.setup.ps1keeps the resident release whenever there is no installer handoff (unsloth studio update, the Desktop startup repair, a re-run of setup), forced or not. Unpinned, a missing torchvision alone resolved the newest torchvision and moved torch 2.13 to 2.14.1. Only a release the selected CUDA index publishes is pinned (cu126 from 2.6, cu128 2.7, cu129 2.8, cu130 2.9); a prerelease or dev build never is.install_python_stack.py. That retry downloaded a second torch, usually after a transient failure. An unforced run retries exactly what an unpinned run would have done.studio updatetorch freeze writes its overrides file to a directory uv can name (%TEMP%through its short name, else%PUBLIC%,/tmp,/var/tmp) and stops rather than resolving unfrozen when none exists.torchaudio==2.11.*, ininstall.ps1and in all threesetup.ps1trios.Triton (
studio/setup.ps1)triton-windowsis chosen from the installed torch right before the Triton step: torch 2.13 gets>=3.7,<3.8, torch 2.14>=3.8,<3.9, anything else keeps<3.7. torch 2.13 pins triton 3.7.1 and 2.14 pins 3.8, and PyPI has cp313win_amd64triton-windows wheels for both. Windows on ARM is unchanged._msvc_env.py) names the same range for the resident torch, and the Windows on ARM floor on ARM64, instead of always<3.7.studio update(install_python_stack.py): the cu130 repair specs and the core-update torch freeze from #12150 now apply on native Windows x64 too, sostudio updatedoes not downgrade a Windows torch 2.13 install. An emulated x64 Python on Windows on ARM is excluded.Checked and unchanged: the Windows xFormers table already maps torch 2.13 + cu130 to xFormers 0.0.35.
Tests
tests/studio/test_cu130_torch213_route.ps1(100 checks): the route predicate across index, architecture, interpreter and platform; every PyPI gate answer including offline, upload cutoff and configured mirrors;Requires-Distparsing; the kept-release window and the closed-route upgrade case; the on-disk version read for broken and CWD-relative venvs; the--packagegate; the resident-torch probe on release, local, rc and dev versions; setup's own torch block run with the installer stubbed (unforced keep, forced keep, failed pins, UPGRADE=1, index floors); triton pairing; and where each piece is wired in.studio/backend/tests/test_cu130_repair_torch_specs.py: 29 on main, 43 here, all passing. The main-side case asserting "win32 cu130 unchanged" now expects Windows x64 on the route; Windows on ARM exclusion and freeze cases are added.studio/backend/tests/test_msvc_env_triton_hint.py(6 tests).tests/sh/test_cu130_torch213_route.sh: the--packagegate on Linux.tests/studio/*.ps1that touchesinstall.ps1orsetup.ps1passes. The 4test_rocm_support.py::TestProgressStepCountMatchesTotalfailures are the same on main.Windows install runs
On a windows-2022 runner (no GPU, so the cu130 index is forced with
UNSLOTH_TORCH_INDEX_FAMILY=cu130), with the Windows wheels from #13261 attached to a staging release:UNSLOTH_TORCH_UPGRADE=1flash_attn_2_cudaimportsflash_attn_2_cudaimportsinstall-kernels causal_conv1dcausal_conv1d_cudaimportsMerge order
The newest unsloth on PyPI already admits torch 2.13, so this route turns on as soon as it merges. It should go in after #13261 has published the Windows wheels and #13262 (the Studio side that installs them); merged first it would only give new installs torch 2.13 without the kernels yet. No kernel has run on a Windows NVIDIA GPU yet; torchcodec, torchao and bitsandbytes resolution against torch 2.13 on Windows is worth a real install before release.