Repository navigation
Studio: download prebuilt kernel wheels once - #14051
danielhanchen merged 22 commits into
Conversation
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. |
|
Reached Codex review convergence at oobabooga#384. |
# Conflicts: # tests/python/test_install_python_stack.py [skip ci]
|
@codex security review |
…'s project [skip ci]
|
Codex Review: Didn't find any major issues. Swish! 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". |
# Conflicts: # studio/backend/utils/wheel_utils.py
…nsloth into r14051 # Conflicts: # studio/backend/tests/test_flux3_prompt_upsampler.py
[skip ci]
|
Codex Review: Didn't find any major issues. Hooray! 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". |
|
Codex Review: Didn't find any major issues. 🚀 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". |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
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_wheelcaptures uv's output, so the progress bar shows nothing for the whole 2 x 427 MB. At 256 KiB/s onwindows-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 auv.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 asUV_CACHE_DIRstill 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, astill installing flash-attn (N min)note is printed each minute.Every caller of
install_wheelgets 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:
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:
After:
(The update has 18 steps instead of 17 because it adds a base-packages step. Captured output is block-buffered, so the
7/18line appears with the first note.)Behavior boundaries
uv.toml, orpyproject.tomlwith[tool.uv), or whenUV_PROJECTselects a project, because pointing--projectelsewhere would make uv ignore that config. It also runs as before whenUV_CONFIG_FILEorUV_NO_CONFIGis set, or when the URL has no parseable wheel filename.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 runsunsloth studio updatetwice, with GitHub downloads throttled to 1 MiB/s. Arm B applies this diff first.In arm B a single
uv --project <temp dir> pip installprocess 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'sMETADATAsits in its last 20 KB.flash-attn imports afterwards in both arms.
Tests:
studio/backend/tests/test_wheel_download.pycovers 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 relativeUV_CACHE_DIRthat must stay in the working directory. Another checks that a project chosen withUV_PROJECTstill applies its config. Both pass with uv 0.11.16 and 0.13.1.tests/python/test_install_python_stack.pycovers the progress output on a terminal and when captured.wheel_utilssuites pass, andruff checkandscripts/run_ruff_format.pyare clean.