Skip to content

Windows on ARM: install the native ARM64 CUDA stack on NVIDIA hosts - #10282

Merged
danielhanchen merged 175 commits into
mainfrom
woa-native-arm64-cuda
Sep 16, 2026
Merged

danielhanchen merged 175 commits into
mainfrom
woa-native-arm64-cuda

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

What this is

irm https://unsloth.ai/install.ps1 | iex does not produce a working install on NVIDIA's Windows-on-ARM laptops (GB10 / N1X, the RTX Spark parts). This makes it work, without changing what any other host does.

Why it fails today

We treat every ARM64 Windows host as "no GPU wheels exist here" and fall back to x64 Python under emulation. That fallback is convincing for a while: x64 torch installs, loads, and reports torch.cuda.is_available() == True. It then fails on the first kernel, because triton-windows bundles a ptxas built for the x64 CUDA 12.8 toolkit and that ptxas cannot target the sm_121 these parts report:

ptxas fatal: Value 'sm_121a' is not defined for option 'gpu-name'

So every Unsloth kernel fails to compile. Separately, llama.cpp picked the CPU-only windows-arm64-cpu bundle regardless of the GPU, then tried to hydrate a source tarball that fails on MAX_PATH and falls back to a source build asking for CMake and Visual Studio Build Tools through UAC.

None of this is necessary any more. These machines run CUDA natively, and every piece now exists: NVIDIA publishes win_arm64 CUDA torch (GA at pypi.nvidia.com/nvtorch_oot: torch 2.14.0+cu134, torchvision 0.29.0, torchaudio 2.11.0), triton-windows ships win_arm64 from 3.8.0.post28, bitsandbytes 0.50.2 ships a cuda134 DLL, and ggml-org publishes llama-*-bin-win-cuda-13.4-arm64.

Approach

Detection is evidence based, not architecture based. The installer asks the wheel indexes what actually exists for this interpreter, and takes the native path only when it finds both a win_arm64 CUDA torch and an obtainable pyarrow. Anything else keeps the historical x64 path. A host that cannot be fully served natively is never left with a half configured venv that dies at the datasets step.

The torch index is probed in order: download.pytorch.org first, then NVIDIA's GA channel, then its nightly. That ordering matters for maintenance: the day PyTorch publishes these wheels themselves, the official index wins and this special case retires itself with no code change.

Requirement pins are split, not loosened. Packages with no win_arm64 wheel get a platform_machine == "ARM64" marker rather than a widened range. "ARM64" is Windows-on-ARM specifically: macOS is "arm64" and Linux is "aarch64", so the isolation is exact. I checked this two ways, by evaluating every marker per platform (linux x86_64, linux aarch64, win x64, macOS arm64, macOS x86_64 all resolve to the pins they had before) and by the test suite.

Also in here

  • llama.cpp prebuilt selection learns a windows-arm64-cuda install kind and falls through to upstream's win-cuda-13.4-arm64 asset, so these hosts get a CUDA bundle. When neither our asset nor upstream's is hash gated the fallback is still taken, but it says so in the log rather than silently.
  • setup.ps1 keeps an installed cu134 torch on win_arm64 instead of "repairing" it into a cu130 that has no wheel for this platform, and asks the chosen index whether it publishes torchaudio rather than assuming it does not.
  • install.ps1 checks, before handing off to studio setup, that the installed package understands this host, and stops with an explanation if it does not. See the note on merge order below. UNSLOTH_WOA_NATIVE=0 opts back out to the x64 path.

Verification

Clean install into an empty UNSLOTH_STUDIO_HOME on an RTX Spark N1X, invoked the way the one-liner invokes it (piped into Invoke-Expression, no arguments), ends EXIT=0:

Check Result
Path selection automatic, "Windows on ARM + NVIDIA: native CUDA wheels available"
Torch trio 2.14.0+cu134 / 0.29.0+cu134 / 2.11.0+cu134, CUDA available, sm_121
Triton kernel compile ok, 0.9 s
LoRA / QLoRA SFT, Qwen3-0.6B loss 1.67 / 1.75, peak 2.56 / 1.96 GB
llama.cpp llama-b10715-bin-win-cuda-13.4-arm64.zip, backend cuda, validated not rebuilt
Qwen3.8-27B-GGUF UD-Q4_K_XL 8.1 tok/s generation, GPU at 94-95 percent throughout
Studio serves, /api/health healthy, "Hardware detected: CUDA"
Optional libraries tensorboard, av, soundfile, sklearn, pymupdf, cryptography, pandas, trl, peft, bitsandbytes, triton all import
Wheelhouse actually needed re-run with a wheelhouse holding pyarrow alone: still EXIT=0, native, CUDA available, with tiktoken, brotli, hf_transfer, grpc, xformers and sqlite_vec absent. Studio boots healthy with one degraded line, RAG unavailable: sqlite-vec could not be imported

No regressions: tests/studio/install gives an identical failure set before and after, measured in the same venv, with nothing new and nothing masked.

Split out of this PR

Three things that were in here are not about Windows on ARM, and are now separate PRs against main:

PR what size
#10471 Four uninstaller fixes. Two change behaviour on Linux and macOS: an ownership gate that stranded older installs, and ~/.unsloth/studio being deleted with no ownership check at all. +313
#10472 Kaggle GPU harness: an all-[N/A] compute-apps listing means nvidia-smi cannot attribute memory, not that the card is idle. +538
#10484 run_pwsh never set the writing end of the PowerShell pipe, so 5.1's OEM code page and pwsh 7's UTF-8 were both decoded with the ANSI one. This is why parity (windows-latest) is red on main today, not just here. +185

All three are reverted here, or were never in here, so this branch matches main byte for byte on those files. This PR went from 38 files and +11591 to 29 and +9897.

#10484 is worth calling out separately: it is not a Windows-on-ARM fix at all. It came out of running this branch's suite on a real Windows ARM64 box, where the pre-existing encoding mismatch stopped being a wrong answer and started being a silent stdout is None. It fixes a gate that is red on main.

Where the remaining 9897 lines are

lines
tests 6794
CI workflows 166
product code 2937

Tests: 6794 lines producing 1525 test cases, 4.5 lines per case.

file lines cases
test_woa_torch_index_persistence.py 4397 512
test_windows_arm64_wheelhouse_tags.py 1092 145
test_windows_arm64_requirement_markers.py 359 804
test_woa_wheelhouse_guard_behaviour.py 270 35
test_llama_kind_gate_matches_selector.py 195 13
test_woa_wheelhouse_prefers_pypi.py 183 16

48 percent of those lines are string literals, because a test that pins PowerShell behaviour has to carry the PowerShell it runs. 39 percent is Python, 11 percent blank, 2 percent comments.

Product: 2937 lines.

file lines what
install.ps1 1375 723 in 32 new helper functions, 652 integrating them across 148 separate places in the main flow
install_python_stack.py 685 14 new functions: machine arch from the registry, wheel-tag matching, marker evaluation, wheelhouse staging
setup.ps1 589 17 new functions; the update and repair paths have to reach the same answers install.ps1 did, from a fresh shell
install_llama_prebuilt.py 187 the windows-arm64-cuda install kind and the upstream fallback
windows-arm64-ci.yml 166 the windows-11-arm CI leg
everything else 100 manifest, requirements, pyproject, gitignore, tauri

Why the installer needs 32 new functions

They are wheel-tag parsing, abi3 compatibility, PEP 440 ordering, environment-marker evaluation, TOML parsing and requirement rebasing. Python's packaging does all of it in a library.

It cannot be used, because of where the decision has to happen:

install.ps1:4483  Initialize-WoaNativeCudaTorch -PythonMinor $PythonVersion
install.ps1:4487  $DetectedPython = Remove-SkippedPython (Find-CompatiblePython)

The probe decides whether to install an ARM64 or an x64 Python, so it runs before any interpreter exists. Every packaging primitive it needs has to be written in PowerShell.

On the Python side the same primitives appear again in install_python_stack.py, and there they are not duplication: _version_satisfies and _marker_is_active try packaging first, then pip._vendor.packaging, and only fall back to their own numeric comparison for a venv that has neither, which is the state that half of a bootstrap runs in.

Why the tests are twice the code

Every one of those 32 functions is a parser with edge cases, and none of them can be imported: they are nested inside Install-UnslothStudio in a script that is fetched and piped to Invoke-Expression. The suite lifts each function out of the source by name and runs it in a real pwsh, so a case costs a script string as well as its assertions. The 804 marker cases are the cheapest per line and the most valuable: they evaluate every requirement marker this PR touches against 31 environments, which is what shows that no row moves on any host that is not Windows on ARM.

Two things on our side before this helps anyone

  1. Host the wheelhouse: done, interim host. A handful of packages have no win_arm64 wheel on PyPI and would otherwise need a compiler on the user's machine. The installer reads UNSLOTH_WOA_WHEELHOUSE, now defaulting to https://huggingface.co/danielhanchen/unsloth-blackwell-docker/resolve/main/windows-arm64-wheels (commit 46e706e). It holds the two wheels that matter: pyarrow 25.0.1 for cp311 through cp314, which gates the native path because datasets needs it, and sqlite-vec 0.1.9, which is not a gate but is what RAG imports. Both were built on GitHub's hosted windows-11-arm runner from their release tags: pyarrow with GH-47195: [Python][CI] Add support for building PyArrow library on Windows ARM64 apache/arrow#48539's build script overlaid on the apache-arrow-25.0.1 tag (about 45 minutes per interpreter, trimmed to what datasets uses), sqlite-vec by compiling its DLL with MSVC for ARM64 and repacking the PyPI wheel under the win_arm64 tag (PyPI's is py3-none-win_amd64, one DLL plus pure Python, not py3-none-any as I wrote earlier). Every wheel was smoke tested on that runner, every native image inside is ARM64 by PE header, and install.ps1 ran its native path against the published URL end to end on the same runner: pyarrow 25.0.1, torch 2.14.0+cu134 and sqlite_vec 0.1.9 all import in the win-arm64 venv. Moving the five files to unsloth/windows-arm64-wheels is an upload plus one URL change. tiktoken, regex, brotli, hf_transfer and grpcio are not needed: nothing on the install path imports them, and an install without them is healthy.

Upstream pyarrow is aware of this: apache/arrow#48539 builds win_arm64 and is finished, but it is on hold behind apache/arrow#50398, the abi3 transition, with no date. PyPI still publishes zero win_arm64 pyarrow files as of 2026-09-09. That plan sets an abi3 floor of 3.11, so the first upstream wheel will be named cp311-abi3, which this PR already accepts, and our copy simply stops being used when it lands.
2. Publish a windows-arm64-cuda llama.cpp artifact, or list the upstream arm64 asset hashes, so the unverified upstream fallback can be removed.

One dependency outside this PR

Flex attention's backward pass does not compile on these parts, with or without this PR. The
shipped shared-memory gate in unsloth_zoo under-estimates usage on every GPU whose only
offered config has num_stages = 1, which is what sm_121 gets at head_dim >= 128, so the
gate never fires and Triton is handed a config needing 114688 bytes against a 101376 byte
limit. Fixed in unslothai/unsloth-zoo#1165.
Reproduced cold on a clean install from this branch: fails with stock unsloth_zoo, passes
with that fix, same environment. It is independent of the installer, so it is a separate PR,
but flex attention is broken on this hardware until it lands. Ordinary QLoRA is unaffected and
trains on a stock install.

Merge order matters

The script is fetched live from unsloth.ai while the package comes from PyPI, so the two halves ship separately. Shipping this script before the release is worse than shipping neither: the patched script installs a working +cu134 torch, then an older setup.ps1 reads that family as "not this host", reinstalls a cu130 that has no win_arm64 wheel at all, and leaves the environment with no torch. The capability check above turns that into a clear stop rather than a broken venv, but the clean fix is to release the wheel first or at the same time.

Note on #5945

That PR routes Windows-on-ARM plus NVIDIA through WSL2. Its premise, that there is no native win_arm64 CUDA stack, was true when written and is not any more. Its dry-run probe does keep the native install "if a win_arm64 CUDA wheel ever ships", but it resolves against the download.pytorch.org cu130 index, which has no win_arm64 wheels, so it would still choose WSL here.

Worth knowing before we default anyone to WSL: I ran curl -fsSL https://unsloth.ai/install.sh | sh in WSL on this same machine and it works today, unpatched, ending EXIT=0 with torch 2.11.0+cu130, triton 3.6.0, our own linux-arm64-cuda13 llama.cpp asset, and LoRA training at 1.31 GB peak. But it caps you at the WSL VM's memory (29.31 GiB there against a 45.39 GiB native pool), needs a distro plus admin plus a reboot on a clean machine, and its whisper.cpp prebuilt install fails. WSL is a reasonable fallback, not a better default.

The red aarch64 check is not from this branch

linux ubuntu2404-arm-root is failing here, and it fails the same way on main with no PR involved: run 34255272305 at 5177a5b1d, sole failing job, same error.

x Failed to build `nvidia-npp-cu13==0.0.1`
##[error]built from source: nvidia-npp-cu13 -- these must resolve to wheels on a clean machine

NVIDIA retired nvidia-npp-cu13 on PyPI; its only release is an sdist stub whose build backend raises. It bites aarch64 only because torchcodec has no aarch64 wheel on the pytorch index, so the installer falls back to the generic CUDA 13 wheel and the NPP step then asks for the retired name. x86_64 never reaches that step.

#10587 fixes it, and the fix is verified to turn that exact job green. Nothing in this branch touches it, so it is expected to stay red here until #10587 lands.

uv's inline index spelling was unreadable, and the doubt resolved to public PyPI

Found while reviewing this branch, fixed here. Read-WoaUvTomlIndexKeys returned $null the moment it saw an index key, so index = [{ url = "https://mirror/simple", default = true }], which is valid and documented uv configuration, read as "cannot know". Get-WoaUvConfigIndexPolicy recorded that as Unreadable, and the two consumers of that one flag then disagreed:

  • Test-WoaResolveReachesPyPI honoured it, with the comment "Doubt resolves to 'not PyPI': that answer keeps a wheel, the other loses the package".
  • Get-WoaDependencyIndexArgs never read it and fell through to its https://pypi.org/simple default.

The second is the one that builds the install command, so a host with a corporate mirror written in that spelling had public PyPI appended as a dependency index under --index-strategy unsafe-best-match, in place of the mirror its configuration named.

Fixed at the root: the inline form is now parsed, conservatively. A single-line, brace-balanced array of flat inline tables is read; a multi-line array, a nested value, a bare entry beside a table, a missing url, a non-boolean default or an explicit index all still return $null and stay Unreadable, because guessing is the only outcome worse than not parsing.

The consumers then agree, per call site, because the sites genuinely differ. With no environment default and a policy that is still unreadable, no dependency index is named rather than PyPI substituted. install.ps1's trio step calls uv directly, so uv reads the file itself and that is strictly better than before: no substitution and no failure. studio/setup.ps1's runs under Fast-Install with --index-url, which sets UV_NO_CONFIG and scrubs UV_*, so uv cannot read it there and an empty answer would leave the trio index as the only source; that site stops with a message naming the file, the spelling, and both ways out.

Reading the inline form changes Test-WoaResolveReachesPyPI and therefore wheel pruning, so that was traced first: a mirror URL still answers false and still disables pruning, unmoved, and a genuine pypi.org URL now answers true and enables it, which is correct and was previously being suppressed by a parse failure rather than by a decision.

NVIDIA's Windows-on-ARM parts (GB10 / N1X, the RTX Spark laptops) run CUDA
natively, but the installer treated every ARM64 Windows host as "no GPU wheels
here" and fell back to x64 Python under emulation. That fallback looks like it
works: torch loads and sees the GPU. It then fails on the first kernel, because
triton-windows' bundled ptxas is built for the x64 CUDA 12.8 toolkit and cannot
target the sm_121 these parts report, so every Unsloth kernel fails to compile.
llama.cpp separately picked a CPU-only bundle regardless of the GPU.

Detection is evidence based rather than arch based: the installer asks the wheel
indexes what actually exists for this interpreter, and only takes the native path
when both a win_arm64 CUDA torch and an obtainable pyarrow are found. Anything
else keeps the historical x64 path, so a host that cannot be served natively is
never left with a half configured venv. The torch index is probed in order:
download.pytorch.org first, so this special case ends by itself the day PyTorch
publishes these wheels, then NVIDIA's GA channel, then its nightly.

Requirement pins with no win_arm64 wheel are split on
platform_machine == "ARM64" rather than loosened. Every other platform
(linux x86_64 and aarch64, win x64, macOS arm64 and x86_64) evaluates to the
pins it had before, checked by evaluating the markers per platform as well as by
the test suite.

Also:

* llama.cpp prebuilt selection learns a windows-arm64-cuda install kind and
  falls through to upstream's win-cuda-13.4-arm64 asset, so these hosts get a
  CUDA bundle instead of the CPU one. When neither is hash gated the fallback is
  still taken, but says so in the log rather than silently.
* setup.ps1 keeps an installed cu134 torch on win_arm64 instead of "repairing"
  it to a cu130 that has no wheel for this platform, and asks the chosen index
  whether it publishes torchaudio instead of assuming it does not.
* install.ps1 checks before the studio handoff that the installed package
  understands this host, and stops with an explanation if it does not. The two
  halves ship through different channels (the script is fetched from unsloth.ai,
  the package comes from PyPI), and an older setup.ps1 handed a working +cu134
  torch will reinstall a cu130 that does not exist here, leaving the environment
  with no torch at all. UNSLOTH_WOA_NATIVE=0 opts back out to the x64 path.

Verified on an RTX Spark N1X laptop: clean install into an empty
UNSLOTH_STUDIO_HOME ends EXIT=0 with torch 2.14.0+cu134, torchvision 0.29.0,
torchaudio 2.11.0, triton-windows 3.8.0.post28 and the
llama-b10715-bin-win-cuda-13.4-arm64 bundle; LoRA and QLoRA both train; Studio
serves and reports CUDA; Qwen3.8-27B-GGUF UD-Q4_K_XL answers at 8.1 tok/s with
the GPU at 94-95 percent through generation.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-09T22:25:25.996265Z 09ab3f7 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

Follow up on item 2 above (publishing a windows-arm64-cuda llama.cpp artifact of our own). I looked into whether we can just add it to the build matrix, and we cannot, for a reason outside our control.

unsloth-prebuilt-cuda-windows.yml assembles the toolkit by hand from NVIDIA's redist archives, all of which are windows-x86_64 paths. Checking the redist index for what platforms actually exist:

redistrib_13.3.0.json -> linux-sbsa, linux-x86_64, windows-x86_64
redistrib_13.0.0.json -> linux-all, linux-sbsa, linux-x86_64, windows-x86_64

There is no windows-aarch64 platform in the redist tree, so there is nothing for that job to download. This is also why our linux-arm64-cuda13 asset exists and works (it builds from linux-sbsa) while the Windows ARM64 equivalent does not.

That is the case for the upstream fallback in this PR rather than a stopgap: ggml-org does publish llama-*-bin-win-cuda-13.4-arm64, and until NVIDIA ships Windows ARM64 redists we have no way to reproduce it in CI. The narrow ask stands: list the upstream arm64 asset hashes in llama-prebuilt-sha256.json so the fallback is hash gated like every other path, and the unverified branch can be deleted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5556ac20ab

ℹ️ 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".

Comment thread install.ps1
substep "windows on arm: downloaded pyarrow wheel $wheelName"
} catch {
substep "could not download $wheelName ($($_.Exception.Message))." "Yellow"
$script:WoaNativeCudaTorch = $false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Perform the advertised x64 fallback after staging fails

When the initial wheelhouse probe succeeds but the later pyarrow download fails transiently, this only clears the native flag even though the ARM64 interpreter and venv have already been selected and created. Execution then continues with that ARM64 venv through the ordinary driver-derived CUDA index path (typically cu130), which has no win_arm64 torch wheel, so the installation fails instead of falling back to x64 as the message promises. The staging failure needs to restart interpreter/venv selection or occur before the ARM64 venv is created.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The trigger is a transient download failure, not well-formed input, and the message here says "continuing without the native stack", not that it falls back to x64 (that wording is at a different site). The run fails loudly either way, and the native path was already doomed once pyarrow could not be staged, since datasets cannot resolve without it. Restarting interpreter and venv selection mid-run is a redesign rather than a fix. The sharp edge you name is real though: clearing the flag after the ARM64 venv exists points torch at an index with no wheels for it, and an explicit hard stop there is a reasonable follow-up.

Comment thread install.ps1 Outdated
Comment on lines +4823 to +4825
$env:UV_OVERRIDE = $WoaOverrides
$env:UV_FIND_LINKS = $WoaWheelDir
$env:PIP_FIND_LINKS = $WoaWheelDir

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore package-manager environment after installation

For the documented irm ... | iex invocation, assigning UV_OVERRIDE here modifies the caller's PowerShell process, but the outer finally restores only TMP/TEMP. Consequently every later uv command in the same shell, including commands for unrelated projects, continues using this generated ARM64 override file and can silently replace dependency constraints or suppress packages; the find-links variables leak similarly. Save and restore the prior package-manager variables after the setup child has inherited them.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. These three are exported deliberately so the unsloth studio setup child inherits them through every uv and pip pass, which is why they are set once here instead of threaded through each call site, and restoring them after the child would have to sit at the end of a long multi-exit region. Re-entry is already handled: the block above removes any inherited value whose path points into this StudioHome's own woa directory, matched by path so a user's own UV_FIND_LINKS survives. TMP/TEMP are restored because that directory is deleted, which is a different hazard. A leaked session variable on a host where those packages genuinely have no win_arm64 wheel is hygiene, not a wrong install.

# asks for the arm64 bundles and the windows-arm64-cuda kind.
if arch is None:
arch = windows_cuda_arch_for_host(host)
install_kind = windows_cuda_install_kind_for_arch(arch)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor the architecture when parsing published CUDA assets

When arch is arm64, this now selects windows-arm64-cuda artifacts, but the legacy-name parsing below still matches and synthesizes only *-x64.zip names at lines 3217, 3227, and 3272. A published upstream-style llama-...-arm64.zip is therefore treated as an app bundle: its encoded CUDA minor is not checked against the driver and its matching ARM64 cudart archive is never attached, potentially installing an incompatible or incomplete llama.cpp bundle. Parameterize those legacy expressions and synthetic names with arch as the upstream path already does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The remaining -x64 spellings are in the legacy-name branch, which no real fork manifest enters: every Windows CUDA artifact the fork publishes is app-named (app--windows-x64-cuda13-portable.zip), and the only legacy llama-...-bin- names in the manifest are macOS, which never reach this function. legacy_minors is empty on both arches, so the x64 spelling is equally unexercised and this is a pre-existing latent inconsistency rather than something this PR introduced. The real future artifact goes through the app-bundle path, which is arch-correct including the cudart pairing. Worth parameterizing for tidiness one day.

Review of the branch turned up one real regression and several sharp edges. All of
them are on paths this PR added; none change what a host did before it.

The regression. `_is_windows_arm64()` answers for the MACHINE, and says yes even
under an emulated x64 Python -- its docstring says so, since that is what it is for.
But the requirement markers this PR adds key on `platform_machine == "ARM64"`, which
is the INTERPRETER's arch, and every Windows-on-ARM install predating native support
is running an emulated x64 interpreter, because install.ps1 deliberately fetched one
there. So on exactly those existing installs the two mechanisms disagreed: the marker
rows correctly selected the x64 pins while the new skip list dropped ten packages
(xformers, tiktoken, tensorboard, librosa, openai-whisper, hf_transfer, sqlite-vec,
mecab and the rest) that have working win_amd64 wheels and install fine today. Anyone
taking the new UNSLOTH_WOA_NATIVE=0 escape hatch would have hit it too.

`_is_win_arm64_interpreter()` answers the other question, from
`sysconfig.get_platform()` -- the same authority pip and uv tag wheels with -- and
the two call sites this PR added now use it. The pre-existing uses of the machine
predicate are left alone, so nothing outside this PR shifts.

The rest:

* setup.ps1 answers `Test-WinArm64Venv` from the machine arch before launching any
  interpreter. The callers sit in the stale-venv path, which on x64 previously
  executed nothing at all; probing a venv's python there to learn something already
  known gave a corrupt or lock-blocked interpreter a chance to hang the install.
* `$expectedKinds` gains windows-arm64-cuda only on the arch that can carry it.
  Accepting it on x64 would keep an install that machine cannot run, where today it
  is removed as mismatched.
* The wheelhouse reuses a staged wheel only if it opens as a zip. An interrupted run
  leaves a truncated file, and skipping on mere existence handed the resolver that
  same corpse on every retry. Both downloads also take a timeout now.
* UV_OVERRIDE / UV_FIND_LINKS / PIP_FIND_LINKS are cleared when they point into this
  StudioHome's own woa directory, so a second `irm | iex` in one shell cannot inherit
  a previous run's wheelhouse. Matched by path rather than cleared outright: an
  inherited UV_FIND_LINKS that a user set for their own wheelhouse is left alone,
  since clearing it would break air-gapped installs on every Windows host.
* hf_transfer in no-torch-runtime.txt and cryptography in studio.txt (and its mirror
  in pyproject) get the same marker split as the other rows. That file installs
  --no-deps and the extra is installable directly, so neither was covered by the
  constraints file.
* `windows_cuda_arch_for_host` tests is_windows as well as is_arm64. Every caller is
  already inside a Windows branch, but `is_arm64` is also true on macOS arm64 and
  Linux aarch64, so the answer should not depend on the caller remembering that.
* The published legacy-minor scan uses the arch being resolved instead of a
  hardcoded x64, which was harmless only while no arm64 CUDA artifact existed.
* No `windows_cuda_selection` log line on x64, where the arch is the unspoken
  default and the line would be new output in every existing install log.

Verified: requirement markers resolve identically to origin/main across 65
environments (linux x86_64/aarch64/arm64/armv7l/ppc64le/s390x, win32
AMD64/x86/ARM64EC, darwin arm64/x86_64, freebsd, python 3.10 to 3.14), differing
only on win32/ARM64; the studio-extra mirroring guard passes; both PowerShell files
parse; and a simulated interpreter matrix confirms the win_arm64 skip list applies
on a native ARM64 interpreter and on nothing else, including the emulated x64 case
that regressed.
@danielhanchen

Copy link
Copy Markdown
Member Author

Pushed a follow-up commit after a hard look at what this changes for hosts that are not the new one. Recording what was found, including the one real regression, so the review does not have to rediscover it.

The regression

_is_windows_arm64() answers for the machine. Its docstring says so, and that is what it is for: platform.machine() reports AMD64 under an emulated x64 Python, and PROCESSOR_ARCHITEW6432 is ARM64 in exactly that case.

But the requirement markers this PR adds key on platform_machine == "ARM64", which is the interpreter's arch. And every Windows-on-ARM install predating native support is running an emulated x64 interpreter, because install.ps1 deliberately fetched one there.

So on exactly those existing installs the two mechanisms disagreed. The marker rows correctly selected the x64 pins, while the new skip list dropped ten packages that have working win_amd64 wheels and install fine today: xformers, tiktoken, tensorboard, librosa, openai-whisper, hf_transfer, sqlite-vec, mecab, torch-c-dlpack-ext, pytorch_tokenizers. Anyone taking the new UNSLOTH_WOA_NATIVE=0 escape hatch would have hit it too.

_is_win_arm64_interpreter() answers the other question, from sysconfig.get_platform(), which is the same authority pip and uv tag wheels with. The two call sites this PR added now use it. The pre-existing uses of the machine predicate are untouched, so nothing outside this PR shifts.

Simulated across eight interpreters:

interpreter skip list applies machine predicate
linux x86_64 / aarch64, wsl aarch64 False False
macos arm64 / x86_64 False False
windows x64 False False
windows ARM64 machine, emulated x64 python False True (this is the disagreement, and it is now deliberate)
windows ARM64 native python True True

Also fixed

  • Test-WinArm64Venv answers from the machine arch before launching any interpreter. Its callers sit in the stale-venv path, which on x64 previously executed nothing at all; probing a venv's python there gave a corrupt or lock-blocked interpreter a chance to hang the install, for an answer already known.
  • $expectedKinds gains windows-arm64-cuda only on the arch that can carry it. Accepting it on x64 would keep an install that machine cannot run, where today it is removed as mismatched.
  • The wheelhouse reuses a staged wheel only if it opens as a zip. An interrupted run leaves a truncated file, and skipping on mere existence handed the resolver that same corpse on every retry. Both downloads now take a timeout.
  • UV_OVERRIDE / UV_FIND_LINKS / PIP_FIND_LINKS are cleared when they point into this StudioHome's own woa directory, so a second irm | iex in one shell cannot inherit a previous run's wheelhouse. Matched by path rather than cleared outright: an inherited UV_FIND_LINKS a user set for their own wheelhouse is left alone, since clearing that would break air-gapped installs on every Windows host.
  • hf_transfer in no-torch-runtime.txt and cryptography in studio.txt (and its mirror in pyproject.toml) get the same marker split as the other rows. That file installs --no-deps and the extra is installable directly, so neither was covered by the constraints file.
  • windows_cuda_arch_for_host tests is_windows as well as is_arm64. Every caller is already inside a Windows branch, but is_arm64 is also true on macOS arm64 and Linux aarch64, so the answer should not depend on the caller remembering that.
  • The published legacy-minor scan uses the arch being resolved instead of a hardcoded x64, which was harmless only while no arm64 CUDA artifact existed.
  • No windows_cuda_selection log line on x64, where the arch is the unspoken default and the line would be new output in every existing install log.

What was checked and found clean

  • Requirement markers: resolved requirement sets are identical to origin/main across 65 environments (linux x86_64/aarch64/arm64/armv7l/ppc64le/s390x, win32 AMD64/x86/ARM64EC, darwin arm64/x86_64, freebsd, python 3.10 through 3.14), differing only on win32/ARM64. The two marker halves were also proven to be a true partition: no overlap, no gap. platform_machine == "ARM64" is a case-sensitive string compare, so it cannot match macOS arm64 or Linux aarch64.
  • studio extra mirroring: test_studio_extra_matches_requirements.py passes before and after, including the new cryptography split.
  • Windows x64: Initialize-WoaNativeCudaTorch returns before any probe, network call or subprocess; $preferX64 reduces to the old expression; Get-TorchIndexUrl falls through unchanged; the pre-handoff check is inside a bare if ($script:WoaNativeCudaTorch); and Fast-Install's flag stripping cannot remove a flag on x64, because the only producer of those tokens is an empty array there.
  • Linux and macOS: every new Python helper is behind a sys.platform == "win32" gate, and UV_FIND_LINKS set on a Linux box for unrelated reasons is never read, because the only caller is inside that gate.
  • --tauri and upgrades: the migration region of install.ps1 is byte-identical to main, so a v0.1.701-beta desktop user re-running the installer follows the old path exactly. No changed line touches shortcuts, PATH persistence, API keys or auth. install.ps1 is the only changed file bundled into the desktop app; the other nine arrive via PyPI.
  • Old install.ps1 with a new package: UNSLOTH_WOA_HAS_TORCHAUDIO unset means "assume no torchaudio" on both the PowerShell and Python sides, which is the historical behaviour, so an unpatched script paired with a patched wheel behaves as before.

Still true, and worth repeating

This PR is inert until the wheelhouse exists at huggingface.co/unsloth/windows-arm64-wheels, and it must be released together with the unsloth wheel, not before it. The pre-handoff capability check turns the wrong order into a clear stop instead of a venv with no torch.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8406faa8d6

ℹ️ 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".

Comment thread install.ps1 Outdated
}
$torchIndex = $null
foreach ($candidate in $candidates) {
if (Test-WoaCudaWheel -IndexUrl $candidate -PythonMinor $PythonMinor -Project "torch") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Probe torchvision before selecting the native stack

When an explicitly configured WoA index or mirror publishes torch but lacks a matching win_arm64 torchvision, this probe still selects native ARM64 and creates the native venv; the mandatory install at line 6337 then requests torchvision>=0.19 and fails rather than retaining the working x64 path. Since custom mirrors are supported and torchvision is not optional in the selected stack, require a compatible torchvision wheel alongside torch during this preflight.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. Checked both built-in candidates: pypi.nvidia.com/nvtorch_oot publishes win_arm64 torchvision for cp311 through cp314t, matching torch's tag set exactly, and the nightly channel has 154 of them. download.pytorch.org has no win_arm64 wheels at all, so it can never win the torch probe in the first place. The failure needs a custom index that serves win_arm64 CUDA torch but no torchvision, which does not exist publicly, and it would be a loud abort on a user-named index rather than a wrong install.

Comment thread install.ps1 Outdated
Comment on lines +6354 to +6355
"--index-strategy", "unsafe-best-match",
"--extra-index-url", "https://pypi.org/simple"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep explicit mirrors from falling through to public PyPI

When UNSLOTH_TORCH_INDEX_URL points to an authenticated corporate or air-gapped mirror, the native branch still adds public PyPI and enables unsafe-best-match, so the explicit source is no longer exclusive and shared dependencies can be selected from or queried against PyPI. uv pip install --help defines --extra-index-url as an index used “in addition to --index-url” and describes --index-strategy as resolution across multiple indexes; therefore this can cause unintended network egress or public-package substitution. Add this fallback only for the built-in NVIDIA indexes, or make the dependency index configurable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The uv semantics you cite are right, and I confirmed them. But reaching this line requires an index that already serves win_arm64 CUDA torch for this interpreter, which today is only NVIDIA's out-of-tree channel, and that channel publishes only torch, torchvision and torchaudio (its /filelock/ is a 404). So the PyPI fallback is load-bearing for the one configuration that exists, and restricting it to the built-in NVIDIA indexes as suggested would leave a torch-only pinned mirror with no source for filelock, sympy or networkx and break it. Worth revisiting if a private win_arm64 CUDA mirror ever appears.

pandas==2.3.3
# pandas publishes win_arm64 wheels from 3.0 only; 2.3.x would source-build there.
pandas==2.3.3; sys_platform != "win32" or platform_machine != "ARM64"
pandas>=3.0,<4; sys_platform == "win32" and platform_machine == "ARM64"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile the local plugin's pandas upper bound

On native Windows ARM64 this constraint now installs pandas 3.x, but studio/backend/plugins/data-designer-unstructured-seed/pyproject.toml still declares pandas>=2,<3. The plugin is deliberately installed with --no-deps, and patch_metadata.py does not patch this distribution, so resolution does not catch the conflict and the completed environment fails pip check while running the plugin against a version its metadata rejects. Widen the plugin dependency after validating pandas 3, or avoid selecting pandas 3 for an environment that includes it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The pip check this rests on is run with both streams to DEVNULL and its return code ignored, under a comment saying third-party conflicts are expected, and it is the only pip check in the studio flow. Nothing validates Requires-Dist at runtime either. Widening the plugin would not produce a clean check anyway: data-designer-config 0.5.4, also installed --no-deps, declares pandas<3,>=2.3.3 and patch_metadata does not rewrite that line, so the same conflict is reported with or without the local plugin. The plugin's pandas use is read_parquet, DataFrame(list[dict]), to_parquet and to_dict, none of which 3.0 changes. The alternative you offer, not selecting pandas 3 there, would reintroduce the source build this constraint exists to remove, since PyPI has no win_arm64 wheel for 2.3.3.

Comment thread install.ps1
Comment on lines +3841 to +3844
if ($script:WoaNativeCudaTorch -and $DetectedPython -and $DetectedPython.Arch -eq "x86_64") {
substep "windows on arm: found an x64 Python $($DetectedPython.Version); installing the native ARM64 build..." "Yellow"
$Arm64Python = Install-PythonFromPythonOrg -Arch "arm64"
if ($Arm64Python -and $Arm64Python.Arch -ne "x86_64") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require an actual ARM64 interpreter for the native path

On a Windows-on-ARM host that has only a supported 32-bit Python, Find-CompatiblePython records its architecture as unknown and may return it when no ARM64 candidate exists, but this guard replaces only x86_64. The native flag therefore remains enabled, a win32 venv is created, and every staged win_arm64 wheel is unusable; similarly, the success check at line 3844 accepts an installer result whose architecture is merely not x64. Gate continuation on Arch -eq "arm64" and otherwise install a verified ARM64 interpreter or take the x64 fallback.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. Reaching Arch = unknown needs a Windows-on-ARM NVIDIA workstation whose only supported Python is a 32-bit x86 build, which is not a configuration this installer receives. The proposed gating is also not safe: CPython gh-145410 has sysconfig.get_platform() returning win32 on a genuine 64-bit interpreter when sys.version is truncated, so requiring Arch -eq arm64 would demote a real ARM64 host to the x64 fallback. The consequence you describe is now closed anyway by the venv platform gate added for the migrated-venv item: a win32 venv drops the native stack regardless of how the interpreter classified itself.

Two parity tests read install.ps1 and setup.ps1 as text, and both changes in this
PR moved the strings they look for. The behaviour they guard is intact in each
case, so the fix is on this side rather than in the assertions.

test_install_ps1_bounds_unknown_leaf_pinned_torch pins the literal
"@_torchSpecs --default-index $TorchIndexUrl", which is how it checks that the
bounded companion specs actually reach uv. The Windows on ARM branch inserted
@_torchExtraArgs between the two halves. Those arguments are all flags and their
values, never positional packages, so uv accepts them anywhere on the line;
moving them after the index restores the literal and changes nothing about the
resolve.

test_setup_ps1_scrub_covers_pip_fallback slices a fixed 2500 character window
from "function Fast-Install" and requires the pip fallback to appear before the
finally that restores the scrub. The flag stripping loop added here is sixteen
lines and pushed the finally out of that window: the fallback is still inside the
try, but the test could no longer see it. Lifting the loop into
Remove-UvOnlyResolverFlags puts Fast-Install back near its original size, with
the finally at offset 1695 against a 1629 baseline on main.

The helper was exercised against the inlined version it replaces on all six
shapes: no flags, --index-strategy in both spellings, --prerelease in both
spellings, and an empty list. Output is identical, including the empty-in
empty-out case that every caller in the tree takes today.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9d9fe3e5a

ℹ️ 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".

Comment thread studio/install_llama_prebuilt.py Outdated
resolve_windows_cuda_choices(
host,
llama_tag,
github_release_assets(UPSTREAM_REPO, llama_tag),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fall back to the published ARM64 CPU bundle on API errors

On the default fork path for an ARM64 NVIDIA host without an approved fork CUDA artifact, this extra upstream GitHub API lookup must succeed before the already-resolved windows-arm64 CPU choice is considered. If that request is rate-limited, offline, or transiently fails while the fork manifest and its approved CPU asset are available, the exception escapes to the outer source-build recovery instead of using the CPU prebuilt, which can turn an otherwise viable Windows ARM64 install into a toolchain-dependent build failure. Catch this optional upstream lookup failure locally and continue to the published CPU choice.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The x64 NVIDIA branch calls github_release_assets exactly as unguardedly a few dozen lines earlier, and has no CPU fallback to lose at all, so the new ARM path is already more forgiving than the shipped one. The non-transient case does not exist either: the manifest's upstream_tag is a plain upstream tag and it resolves. That leaves offline, which breaks the asset download too, and a bare rate-limit window that needs the earlier fork-release call to have succeeded first. Reasonable resilience polish for a follow-up rather than a defect here.

test_installer_never_installs_an_unpinned_xformers flags every quoted xformers
literal in install.ps1 that is not the exact pin. The Windows on ARM block added
one, but it is a removal list: those names are written into the requirement
overrides so the package vanishes from the resolve, since win_arm64 has no
xFormers wheel and no buildable sdist. A version pin there would be meaningless,
and the name has to match the requirement line exactly for the override to bind.

The test already carves out wheel filenames on the same grounds, that a filename
is not a spec. This adds the drop list beside it rather than loosening the
assertion. Checked that it stays narrow: a bare "xformers" appended at end of
file is still caught, and so is a loose "xformers>=0" placed on the line
immediately above the drop list, while the real file is clean.
Resolve three conflicts against the release-preservation work that landed on main:

- install.ps1 torch install: take main's hoisted $_pinTorchSpec trio and its kept-release
  retry, and skip release preservation on the WoA native route, whose specs are
  deliberately unbounded and whose install carries $_torchExtraArgs the kept-release
  command does not.
- studio/setup.ps1 CUDA install: same, inside main's new retry loop, with the ARM64 trio
  and index args applied per iteration.
- studio/setup.ps1 $expectedKinds and studio/install_python_stack.py skip lists: keep the
  new ARM64 entries under main's shortened comments.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Six defects found in review, all on the new WoA path and none reachable on any
other host.

Probe the interpreter that was actually selected. Initialize-WoaNativeCudaTorch
answered for $PythonVersion, but Find-CompatiblePython falls back to another
supported minor whenever the requested one is not installed. Every native
decision is keyed to an interpreter tag, so a 3.13 answer carried into a 3.12
venv staged a cp313 pyarrow wheel and then pinned pyarrow== to it, forcing the
Arrow sdist this path exists to avoid. Re-probe once the interpreter is settled,
key the staged tags on the venv's own minor, and clear every script-scope answer
on entry so a second probe cannot inherit the first one's.

Redact the selected torch index. The status line printed
$script:WoaTorchIndexUrl verbatim, and it can be UNSLOTH_TORCH_INDEX_URL with
userinfo or a token query. It was the only index line in the file that did not
redact. Remove-IndexUrlCredentials moves up to the other helpers, since
PowerShell resolves a function only once its definition has executed.

Hand uv a space-free override path. uv reads UV_OVERRIDE as a space-separated
list of files, which this script splits on \s+ itself, and the default
StudioHome sits under %USERPROFILE%. An overrides file under a path with a space
was read as two paths, neither of which exists, and every later uv call failed
with "File not found". Same defect and same remedy as
backend/utils/uv_path_safety.py (issue #6503), which the Python half already
applies. pip splits its repeatable options the same way; UV_FIND_LINKS is
comma-separated and is untouched.

Do not enable the native stack for an x64 venv. The migration branches keep a
healthy legacy environment as it is, and on this host those are x64 by design.
Get-TorchIndexUrl returns the win_arm64 index on the flag alone while the spec
lift is gated on the venv's platform tag, so a migrated venv was asked for the
bounded x64 specs from an ARM64-only index and aborted with no fallback. Ask the
venv the same question the spec branch asks.

Accept every spelling of a local wheelhouse. UNSLOTH_WOA_WHEELHOUSE is
documented as taking a directory or a base URL, but only drive-plus-backslash
and UNC counted as local, so C:/wheels went to Invoke-RestMethod and the native
path was dropped on a host whose wheels were present. Ask the filesystem instead.

Count a wheelhouse wheel only for the interpreter it was built for. Staging
copies every win_arm64 wheel, cp311 through cp314, but both availability checks
keyed on the distribution name alone. A cp311 tiktoken in a cp313 venv cleared
its skip and its requirement override, and the resolve fell to an unbuildable
sdist. Filter on PEP 425 tags on both sides. WINDOWS_ARM64_SKIP_UNBLOCKED_BY
takes the whole blocker set rather than one name, since librosa needs numba as
well as llvmlite and whisper needs tiktoken too; its openai-whisper key was also
never matched, being looked up canonically.

Let an explicit CPU pin through the CUDA preservation guard. It ran ahead of
every pin check on both sides, so UNSLOTH_TORCH_INDEX_URL=.../cpu was dropped
even though download.pytorch.org publishes win_arm64 /cpu torch and torchvision.
In setup.ps1 it also left PinChangedForceReinstall false, which skips the
dependency pass entirely, so the run kept the CUDA build and reported success.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

The CUDA preservation shortcut reads the interpreter, not the machine, and nothing
in the suite held it to that. Swapping _is_win_arm64_interpreter for
_is_windows_arm64 at the guard leaves 223 of 224 tests here passing, which is the
whole margin between a correct guard and one that strands every Windows on ARM
install predating native support. Those run an emulated x64 python against
ordinary win_amd64 wheels from download.pytorch.org, so the repair has somewhere
to go and must still reach them.

The fixture drove both predicates from one flag, which is right for every case
already here, since a native ARM64 venv is the only place both are true. They
separate on an ARM64 machine running an x64 interpreter, so win_arm64_interpreter
overrides just that half and defaults to the existing flag.

Verified by mutation: with the guard reading the machine instead, the new test is
the only one of the 224 that fails.
$expectedKinds asked Get-HostMachineArch, which answers for the machine. A
Windows-on-ARM host on the x64 fallback runs the prebuilt helper under an
emulated x64 python and installs windows-cuda, so the machine's answer would
call that bundle mismatched and discard a working runtime. Test-WinArm64Venv is
the same predicate the torch path uses, and it short-circuits free on x64.

The block stays inert either way: write_prebuilt_metadata persists no
install_kind, so $existingKind is always null.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9ad4a5c37

ℹ️ 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".

Comment on lines +1141 to +1147
windows_cuda_attempts(
host,
release_tag,
assets,
torch_preference.runtime_line,
torch_preference.selection_log,
arch = "arm64",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply release digests in the direct ARM64 plan

When published_repo is set to ggml-org/llama.cpp (or another non-default repository), resolve_simple_install_release_plans routes through direct_upstream_release_plan, and this new ARM64 CUDA attempt is returned with synthetic empty checksums and expected_sha256=None. The installer therefore downloads and executes the archive during its smoke test without the fail-closed GitHub digest check added in resolve_release_asset_choice; populate these attempts from release_asset_digests(release) and drop any asset lacking a digest before returning the plan.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changed. direct_upstream_release_plan is the opt-in path for a non-default published repo, and by design every attempt it returns carries synthetic checksums: the x64 CUDA, HIP, Vulkan and CPU bundles beside this one. The ARM64 CUDA attempt follows that same contract rather than lowering it; the fail-closed GitHub digest check lives on the default path, where the fork borrows one upstream bundle it does not publish. Verifying the direct plan is a separate change for every platform, not part of the ARM64 support.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

… earlier wheelhouse left for PR #10282

Explicit indexes: uv serves an index marked explicit = true only to packages pinned to it via [tool.uv.sources], so it is neither the default nor an extra for the trio's shared dependencies. The block form [[index]] reader in install.ps1 and setup.ps1 read url and default only and flushed such an entry as a general extra, which Get-WoaDependencyIndexArgs then passed as --extra-index-url to the native torch resolve; the inline table reader refused the key outright, which turned the documented PyTorch pattern into an unreadable policy. Both readers and the Python reader now skip an explicit entry; explicit together with default = true also removes PyPI as the default, which is not modelled, so that combination stays doubt.

Stale wheels: the managed woa\wheels directory persists across runs, so after UNSLOTH_WOA_WHEELHOUSE changed a wheel the earlier wheelhouse staged stayed in it, the hosted scan read it as current and UV_FIND_LINKS installed it from a source no longer configured. Staging now reconciles the directory against the wheelhouse listing it just read, keeping the listed wheels and the selected pyarrow wheel; an unreadable listing (offline) keeps the staged copies, and the directory used as its own wheelhouse lists everything it holds.

Tests: block-form and inline rows on both scripts plus the Python reader, the dependency args never naming an explicit index, and the reconciliation across a local wheelhouse, a URL wheelhouse, an offline listing and the self-sourced directory. Ten mutants on the change are killed.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 79fae82d7b

ℹ️ 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".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

…ec, order xformers after the final torch repair, and key the pip refusal to the generated overrides for PR #10282
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: c6186a4afb

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 09ab3f798d

ℹ️ 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".

# Conflicts:
#	install.ps1
#	pyproject.toml
#	studio/backend/requirements/single-env/constraints.txt
#	studio/install_llama_prebuilt.py
#	studio/install_manifest.py
#	studio/install_python_stack.py
#	tests/studio/install/test_windows_torch_flavor_invariant.py
@danielhanchen

Copy link
Copy Markdown
Member Author

I scanned this branch's shipped scripts on VirusTotal against current main as a control, since the branch changes install.ps1 and studio/setup.ps1 and I wanted to know whether it moves the antivirus position either way.

It does not. No change, in either direction.

Artifact Size Skyhigh Engines
install.ps1, this branch (09ab3f798) 521,874 B DETECTED BehavesLike.PS.Suspicious.hr 1 / 60
install.ps1, main control 470,474 B DETECTED BehavesLike.PS.Suspicious.gr 1 / 60
studio/setup.ps1, this branch 438,398 B undetected 0 / 61
studio/setup.ps1, main control 430,112 B undetected 0 / 55

Zero engine timeouts on both install.ps1 rows, so those are real verdicts rather than an engine failing to run. The .hr versus .gr suffix is the known instability of that family across variants, not a different detection.

install.ps1 is flagged by one engine both before and after this branch, for the reflection-emit apparatus it inherits unchanged. That is pre-existing and is being addressed separately. Nothing here adds to it: the apparatus is byte-for-byte identical at the merge base and at this head (DefinePInvokeMethod 4, DefineDynamicAssembly 7, kernel32 11), there are no new P/Invoke entry points, and tests/studio/test_installer_av_shapes.py passes 44/44 on this head.

I also checked the three added shapes that looked AV-adjacent and all three are fine. Add-Type -AssemblyName System.IO.Compression.FileSystem is the -AssemblyName form, which loads an assembly already on disk and never reaches csc.exe. The five new & $VenvPython -c "..." probes touch a Sigma rule that already fires 13 times on main, and writing those snippets out as .py files instead would be strictly worse. Scripting.FileSystemObject has since landed on main independently.

Two merge-hygiene notes, unrelated to antivirus:

  1. This branch predates main's NVIDIA driver-library probe, and its studio/setup.ps1 carries four kernel32 references where main now has one. Measured, that makes no difference to the scan result, but a merge as-is would reintroduce native surface main has already shed.
  2. The new Get-UvSafePath helper duplicates the short-name logic that merged as Windows installer: stop uv splitting a requirements path, and keep the error position in diagnostics #11064.

Both point at the same thing: worth rebasing onto current main before this lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants