Skip to content

Studio: download prebuilt kernel wheels once - #14051

Merged
danielhanchen merged 22 commits into
unslothai:mainfrom
oobabooga:worktree-kernel-wheel-single-download
Oct 20, 2026
Merged

danielhanchen merged 22 commits into
unslothai:mainfrom
oobabooga:worktree-kernel-wheel-single-download

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Addresses the Windows update hang reported on Reddit (Reddit r/unsloth: "Update install failing"): it halves the prebuilt-wheel download and shows that the install is still running. A slow connection can still take a while.

Problem

Since #13262, Studio setup on Windows installs a 427 MB prebuilt flash-attn wheel at step 6/17 flash-attn. Users reported that the step hangs, and one killed it after 30 minutes. Reporters blamed the torchao fallback warning printed just before the step, but that warning is unrelated: it prints on every Windows CUDA install.

Our reproduction completed, but slowly and silently. To install a wheel from a URL, uv normally fetches only the wheel's metadata, using HTTP range requests. For GitHub release assets those range requests fail, so uv downloads the whole wheel just to read its metadata, discards it, and downloads it again to install (related: astral-sh/uv#18998). install_wheel captures uv's output, so the progress bar shows nothing for the whole 2 x 427 MB. At 256 KiB/s on windows-latest, step 6/17 took about 60 minutes (job).

Fix

  • install_wheel (studio/backend/utils/wheel_utils.py) supplies the wheel's metadata to uv up front, so uv skips the metadata fetch and downloads the wheel once. It writes the package name and version, taken from the wheel filename, into a uv.toml ([[dependency-metadata]]) in a temp dir, and points uv at it with --project. uv still installs from the URL into its own cache, so a later reinstall reuses the cached copy. The user's and system uv configs still apply, and relative paths such as UV_CACHE_DIR still resolve against the working directory.
  • _ensure_flash_attn (studio/install_python_stack.py) shows that the install is still running. On a terminal the progress bar shows the elapsed time; when output is captured, a still installing flash-attn (N min) note is printed each minute.

Every caller of install_wheel gets the single download: setup, unsloth install-kernels, the on-demand causal-conv1d / mamba-ssm installs, and the training worker.

What the user sees

In a terminal, the progress line now counts up in place, once a second, until the install finishes:

  deps           [=======-------------]  6/17  flash-attn 0:03

When output is captured, from the Windows A/B below at 1 MiB/s. The [ Ns] prefix is the CI wrapper's elapsed-time stamp.

Before, nothing for 21 minutes:

[    18s]   deps           [======--------------]  6/18  dependency overrides
[    22s]                  torch 2.13.0+cu130 detected -- installing torchao==0.18.0 from
[    22s]                  https://download.pytorch.org/whl/cu130
[    22s]                  https://download.pytorch.org/whl/cu130 did not serve torchao==0.18.0 -- retrying
[    22s]                  from the default index; its kernels may be skipped
[ 1,289s]   deps           [=======-------------]  7/18  flash-attn
[ 1,289s]   deps           [========------------]  8/18  Unsloth Studio deps

After:

[    16s]   deps           [======--------------]  6/18  dependency overrides
[    18s]                  torch 2.13.0+cu130 detected -- installing torchao==0.18.0 from
[    18s]                  https://download.pytorch.org/whl/cu130
[    18s]                  https://download.pytorch.org/whl/cu130 did not serve torchao==0.18.0 -- retrying
[    18s]                  from the default index; its kernels may be skipped
[    81s]   deps           [=======-------------]  7/18  flash-attn
[    81s]                  still installing flash-attn (1 min)
[   141s]                  still installing flash-attn (2 min)
[   201s]                  still installing flash-attn (3 min)
[...]
[   621s]                  still installing flash-attn (10 min)
[   644s]   deps           [========------------]  8/18  Unsloth Studio deps

(The update has 18 steps instead of 17 because it adds a base-packages step. Captured output is block-buffered, so the 7/18 line appears with the first note.)

Behavior boundaries

  • uv runs as before when a project config would apply from the working directory (uv.toml, or pyproject.toml with [tool.uv), or when UV_PROJECT selects a project, because pointing --project elsewhere would make uv ignore that config. It also runs as before when UV_CONFIG_FILE or UV_NO_CONFIG is set, or when the URL has no parseable wheel filename.
  • The pip fallback is unchanged; pip already downloads once.

Verification

Windows A/B on windows-latest: arm A (run) and two copies of arm B (run). Each installs with the public one-liner, then runs unsloth studio update twice, with GitHub downloads throttled to 1 MiB/s. Arm B applies this diff first.

  • Cold update: flash-attn and the Studio uv cache are deleted first, so the update starts like a fresh install.
  • Warm update: flash-attn is deleted again but the cache is kept, to check that a reinstall still reuses uv's cached copy.
Cold update Warm update
A, before (job) 856,182,074 B (2 downloads), 1,314 s, silent 13,105 B, 44 s
B1, this PR (job) 428,140,611 B (1 download), 698 s, a note each minute 6,938 B, 30 s
B2, this PR (job) 428,192,144 B (1 download), 667 s, a note each minute 6,938 B, 40 s

In arm B a single uv --project <temp dir> pip install process held the wheel URL. One earlier arm B run of the same code (job) moved 357 MB and then 428 MB: the download was cut off partway and uv retried it from the start. It was not the metadata pass, because the wheel's METADATA sits in its last 20 KB.

flash-attn imports afterwards in both arms.

Tests:

  • New studio/backend/tests/test_wheel_download.py covers when the metadata file is written and how uv and pip are invoked. It also runs real uv against a local server that, like GitHub, does not answer range requests: 2 downloads before, 1 after, none on reinstall, with a relative UV_CACHE_DIR that must stay in the working directory. Another checks that a project chosen with UV_PROJECT still applies its config. Both pass with uv 0.11.16 and 0.13.1.
  • tests/python/test_install_python_stack.py covers the progress output on a terminal and when captured.
  • The installer and wheel_utils suites pass, and ruff check and scripts/run_ruff_format.py are clean.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-10-20T14:08:11.798630Z 3f46586 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.

@oobabooga

Copy link
Copy Markdown
Member Author

Reached Codex review convergence at oobabooga#384.

@danielhanchen

Copy link
Copy Markdown
Member

@codex security review

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. Swish!

Reviewed commit: 7697b2250a

ℹ️ 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. Hooray!

Reviewed commit: 7201a7103f

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

Reviewed commit: d2fdb27a5b

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 20, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3f46586c60

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

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