Skip to content

Studio: keep an Apple Silicon install's torch through studio update - #18659

Merged
danielhanchen merged 1 commit into
mainfrom
studio-update-freeze-mac-torch
Nov 20, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-update-freeze-mac-torch

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

unsloth studio update re-resolves unsloth and unsloth-zoo with dependencies. On Linux and Windows x64, _FreezeNewTorchForCoreUpdate pins the resident torch, torchvision and torchaudio through UV_OVERRIDE while that happens, but only for torch >= 2.13. macOS had no freeze.

Apple Silicon is moving to torch 2.13 for new installs only (#18428). Existing installs keep their torch unless the user runs a manual repair, which sets UNSLOTH_TORCH_UPGRADE=1 through install.sh. Without a freeze, a released unsloth with a torch ceiling (2026.9.11 declared torch<2.13.0) could move a 2.13 Mac install back to 2.12 on studio update. A torch floor could also move a 2.11 install up.

Change

  • studio/install_python_stack.py: on Apple Silicon (darwin + arm64), _FreezeNewTorchForCoreUpdate now freezes every resident plain X.Y.Z torch release, not only >= 2.13. install.sh already freezes the trio this way for every with-deps unsloth install, on every OS. The bundled overrides-darwin-arm64.txt is folded into the frozen file, minus any torch lines, so the MLX transformers / anyio / huggingface_hub overrides still apply.
  • Linux, Windows x64, Windows on ARM and Intel macOS behave exactly as before. The predicate for those hosts is unchanged, and an absent or non-release torch still returns early.
  • While the freeze is active, a uv failure on Apple Silicon now stops instead of falling back to pip. pip ignores UV_OVERRIDE and would honour the released cap. This is the same behaviour Linux already has under the freeze.

Tests

New file: studio/backend/tests/test_macos_core_update_torch_freeze.py, CPU only.

  • Apple Silicon at 2.11.0 / 2.12.1 / 2.13.0 / 2.14.0: the trio is pinned, the MLX overrides are folded in, and UV_OVERRIDE is restored afterwards.
  • An unset UV_OVERRIDE is restored to unset.
  • A uv failure under the freeze never runs pip.
  • These hosts are not frozen: Intel macOS, Apple Silicon without a release torch, Linux aarch64 at 2.12.1, Linux arm64 at 2.11.0, Windows arm64 at 2.12.1.

Base (main) vs head: 6 tests fail on main and pass on the branch. The 6 host-unchanged cases pass on both. No head test fails.

Across all 75 test files that import install_python_stack (8.5k tests), the head's failing test IDs are a subset of main's. The failures are pre-existing and come from this host's environment. They are identical apart from one ROCm spoof test that failed only on the main arm.

Not covered

  • No real Apple Silicon run. The uv override semantics are the same ones the Linux freeze and install.sh rely on, but they were not exercised on a Mac here.

… core package resolve

The core unsloth / unsloth-zoo update re-resolves with deps, and the UV_OVERRIDE
freeze that keeps the resident torch trio was scoped to Linux and Windows x64 with
torch >= 2.13. Apple Silicon now gets torch 2.13 only on a new install or a manual
repair (UNSLOTH_TORCH_UPGRADE=1 through install.sh), so the update freezes every
resident release there, the same way install.sh freezes the trio for every with-deps
unsloth install. Linux, Windows and Intel macOS resolve exactly as before.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T18:58:17.202019Z ac4d720 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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: ac4d72086d

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

@danielhanchen
danielhanchen merged commit b7dfb9c into main Nov 20, 2026
@danielhanchen
danielhanchen deleted the studio-update-freeze-mac-torch branch November 20, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant