Skip to content

fix(studio): bundle hf-xet for Desktop large Hub downloads - #10849

Merged
danielhanchen merged 8 commits into
unslothai:mainfrom
Souravrajvi0:feat/desktop-hf-xet-e4ab
Sep 22, 2026
Merged

danielhanchen merged 8 commits into
unslothai:mainfrom
Souravrajvi0:feat/desktop-hf-xet-e4ab

Conversation

@Souravrajvi0

Copy link
Copy Markdown
Contributor

Fixes #10840

Problem

Unsloth Desktop (AppImage) can fail when downloading large GGUF quants with:

ValueError: The file is too large to be downloaded using the regular download method.
Install hf_xet with pip install hf_xet for xet-powered downloads.

When hf_xet is not importable, Studio downgrades Hub downloads to HTTP. huggingface_hub then refuses many large / Xet-backed blobs without hf_xet.

GGUF-only installs apply no-torch-runtime.txt with --no-deps, so huggingface_hub does not pull hf-xet transitively even though full installs often would.

Fix

  • Declare hf-xet>=1.5.1,<2.0 in studio.txt, no-torch-runtime.txt, and single-env/constraints.txt
  • Mirror the pin in the studio extra in pyproject.toml
  • Add a regression test for the no-torch requirements file

Verification

pytest tests/studio/install/test_no_torch_runtime_hf_xet.py tests/studio/install/test_studio_extra_matches_requirements.py

@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: 55fd805a8f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/notebook_validator.py Outdated
# update_all_notebooks.py installs via a runtime `_torchao` variable
# (`"torchao>=0.16.0"` / `"torchao>=0.16.0,<0.18.0"`), which pip
# invocations like `"{_torchao}"` do not surface to parse_spec.
for match in re.finditer(r"torchao>=([0-9.]+(?:\.[0-9]+)*)", install_cell):

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 Restrict the fallback match to the installed _torchao value

Because this regex scans the entire install cell, any comment, diagnostic, or explanatory string containing torchao>=0.16.0 is treated as an actual lower bound. For example, a cell that installs peft==0.19.0 while leaving Colab's older torchao untouched but includes # peft requires torchao>=0.16.0 now suppresses R-INST-003, allowing an incompatible notebook through validation. Parse the _torchao assignment that is subsequently passed to pip rather than accepting every textual occurrence.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not reproducible on head, and this file is not in this PR (the diff is four requirement files plus one test). _install_cell_lower_bound does not regex the cell: it walks unconditional_pip_invocations and parses each package spec, so a mention outside an install target places no floor. Ran it against the exact example: !pip install peft==0.19.0 # peft requires torchao>=0.16.0 returns None, as does the same text inside a print, while !pip install peft==0.19.0 torchao>=0.16.0 returns '0.16.0'. R-INST-003 is not suppressed by a comment.

Declare hf-xet in studio and no-torch runtime requirements so AppImage
and GGUF-only installs (--no-deps) expose Xet transport instead of
falling back to HTTP and hitting huggingface_hub's large-file error.
@Souravrajvi0
Souravrajvi0 force-pushed the feat/desktop-hf-xet-e4ab branch from 55fd805 to e6c9f54 Compare September 13, 2026 07:15
Leftover conflict markers broke uv pip parsing during --no-torch installs
and failed UI/GGUF/API CI on the requirements file at line 51.
@danielhanchen

Copy link
Copy Markdown
Member

Confirmed none of studio.txt, no-torch-runtime.txt, single-env/constraints.txt or the studio extra declare hf-xet today, so a --no-deps GGUF-only env does end up without it. Will get this reviewed.

danielhanchen added a commit that referenced this pull request Sep 13, 2026
…it falls back (#10862)

Repo tests (CPU) carried timeout-minutes: 30 under a comment claiming the job
measured 13.4 minutes. Across the last 40 runs of it on main the pytest step
alone measures 852s to 1683s, and the install plus the four steps after it add
a further 351s, so the worst measured run needs 33.9 minutes. Run 0eedeee
passed at 1738s, 62 seconds under the cap.

Which run loses is a property of the runner, not of the PR. #10849 and #10861
were both cancelled at 30m1x against a green main, on branches that touch none
of this.

The cap also fires mid-step, so the run blames whichever step was unlucky. On
both of those it was "Shell installer tests", 84s in and unrelated, and the
shell, CLI and Docker steps never ran at all, so those PRs silently lost that
coverage too.

Raised to 45, which is what the backend pytest job in this same file already
uses after the identical failure mode. A backstop is only worth raising if
something below it can still name a hang, so this picks up that job's other two
guards, with numbers measured from this suite rather than copied: --timeout=330
against a tail of 63.6s, 48.3s and a run of ~31s cases (this step is ~2.2x
slower on a 4-vCPU runner than on the box that measured them, so the worst
legitimate test is ~140s and the cap is ~2.4x that), and an outer
timeout --signal=INT --kill-after=60 2100, which is 1.25x the worst of the 40
runs and still lands 4 minutes under the job cap.

Separately, tests/utils/test_packing.py now routes its three unbound
_prepare_dataset tests through _fake_sft_self(). They pass a SimpleNamespace as
self, which is fine against the patched implementation (it reads data_collator
and nothing else) and is not fine against TRL's own, which reaches for
self._is_vlm. So when the SFT patch silently falls back, as it did between
unsloth-zoo #1192 and #10854, all four report

    AttributeError: 'types.SimpleNamespace' object has no attribute '_is_vlm'

which names the fake object and not the patcher. Those four were the loudest of
16 failures across five files that all had the one cause. They now assert the
patch applied first and say so.

Padding the namespace out with _is_vlm would be worse than the AttributeError:
the tests would then quietly pass against TRL's trainer and assert nothing
about Unsloth's.

Checked both directions. On main tests/utils/test_packing.py is 62 passed, 2
skipped. Against fc66948, the commit before #10854, the same four fail with
"trl.SFTTrainer is 'SFTTrainer', so Unsloth's SFT patch did not apply". The
--timeout=330 flag was run over the five slowest files in the discovered set:
143 passed, no spurious kills, including the tests that deliberately hang.
@danielhanchen

Copy link
Copy Markdown
Member

Checked the requirement files and the studio extra, and the pin lines up with the huggingface-hub markers already there. One thing before I review: Python < 3.10 installs still get no hf-xet, so can you confirm that path is unaffected?

@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@danielhanchen — Python < 3.10 is unchanged.

Every hf-xet pin is gated with python_version >= "3.10" (same split as huggingface-hub in studio.txt / no-torch-runtime.txt / single-env/constraints.txt and the studio extra in pyproject.toml). On 3.9 we still install huggingface-hub==0.36.2 with no hf-xet line, so the pre-Xet Hub stack behaves exactly as before; this PR only closes the gap on 3.10+ GGUF-only --no-deps installs where large / Xet-backed blobs need hf_xet.

Added test_hf_xet_pins_are_python_310_plus_only in tests/studio/install/test_no_torch_runtime_hf_xet.py so the marker cannot drift.

…he floor to the hub's

The pins arrived marked on python_version only. huggingface-hub gates its own hf-xet dependency on
platform_machine as well, and for a reason this file knows: no-torch-runtime.txt installs --no-deps,
so a machine with no hf-xet wheel resolves the sdist, which builds through maturin and needs a Rust
toolchain. That is the same failure the neighbouring hf_transfer, sqlite-vec and pymupdf lines are
marked against, and .github/scripts/clean-machine-assert.sh fails the clean-machine lane on it.

Checked against the index rather than copied: hf-xet 1.6.0 publishes wheels for x86_64, aarch64,
win_amd64, win_arm64, macOS arm64 and musllinux, and none for ppc64le, s390x, i686 or armv7l -- the
arches install_python_stack.py:414 already calls out as having no torch wheel either, which is
exactly how a user reaches the no-torch path. ARM64 is added on top of upstream's five because the
win_arm64 wheel does exist, so Windows on ARM gets Xet rather than the 50GB HTTP refusal.

Floor raised 1.5.1 -> 1.5.2, which is what huggingface-hub 1.32 declares. Under --no-deps nothing
reconciles the two, so the lower pin could leave an env whose hub asks for more than it has.

The test asserted presence and three python_version evaluations, leaving platform_machine to the
host, so it read x86_64 on every runner and said nothing about the case above. It now evaluates
full marker environments across wheeled and unwheeled machines, checks the floor excludes the
versions below it, and covers all four declarations instead of two. Its 3.9 rationale was also
wrong: hf-xet ships cp38-abi3 wheels and supports 3.9. The >=3.10 split stays because it mirrors
the huggingface-hub 0.36.2 branch and no Desktop path selects 3.9, which is what it now says.
@danielhanchen

Copy link
Copy Markdown
Member

Reviewed this end to end, and pushed two commits to the branch: a merge from main (it had gone conflicting against the ARM64 guards that landed on hf_transfer, sqlite-vec and pymupdf) and one fix commit. Thanks for chasing the Python 3.9 question, that part was right, though not for the reason the test gave.

The bug is real, and only one of the four lines fixes it

Built two venvs the way the installer builds them (uv pip install pydantic with deps, then --no-deps -r no-torch-runtime.txt, per install.sh:4889 and install_python_stack.py:7740), then drove huggingface_hub's own chooser with a 60 GB Xet-backed file:

base  hf-xet=ABSENT  transport=['http_get']  outcome=ValueError: The file is too large to be
      downloaded using the regular download method. Install `hf_xet` with `pip install hf_xet`
head  hf-xet=1.6.0   transport=['xet_get']   outcome=completed

Same result against a real Hub file: base downloads over HTTP with the 'hf_xet' package is not installed warning, head goes through xet_get.

no-torch-runtime.txt is the line that does this. studio.txt is installed with deps and huggingface-hub already declares hf-xet itself, so uv pip compile of studio.txt is byte-identical before and after on 3.11, 3.12 and 3.13 (130/133/130 packages, hf-xet in both). Those three declarations are hygiene, which is fine, but the report should not credit them with the fix.

What I changed

1. The pins carried no platform_machine marker. huggingface-hub gates its own hf-xet dependency on x86_64|amd64|AMD64|arm64|aarch64 deliberately, so machines without a wheel get the HTTP fallback instead of a failed install. Without that gate, and under --no-deps, pip resolves the sdist, whose build backend is maturin: a Rust toolchain on a user's machine. That is the same failure the three lines around yours are marked against ("pip would need cargo plus MSVC"), and it matters most here because the no-torch path is precisely the no-wheels-for-this-arch path (install_python_stack.py:414 names ppc64le, s390x, riscv64).

Checked against the index rather than copied: hf-xet 1.6.0 publishes wheels for x86_64, aarch64, win_amd64, win_arm64, macOS arm64 and musllinux, and none for ppc64le, s390x, i686 or armv7l. So the new marker is upstream's five plus ARM64, because the win_arm64 wheel does exist and Windows on ARM should get Xet rather than the 50 GB refusal.

There is a second consequence: install_manifest.missing_requirements() evaluates these markers too. With the unmarked line it would have demanded hf-xet on ppc64le, s390x and armv7l, where it cannot install, so the install would read incomplete on every repair. With the marker, manifest and resolver agree exactly.

2. Floor raised 1.5.1 -> 1.5.2, which is what huggingface-hub 1.32 declares. Under --no-deps nothing reconciles the two.

3. The test. It asserted presence and three python_version evaluations but left platform_machine to the host, so it read x86_64 on every runner and could not have caught the above. It now evaluates full marker environments across wheeled and unwheeled machines, checks the floor actually excludes the versions below it, and covers all four declarations. 18 tests; 11 of them fail against the original pins. The 3.9 docstring is also corrected: hf-xet ships cp38-abi3 wheels and supports 3.9, so the >=3.10 split stays for the real reason, mirroring the huggingface-hub 0.36.2 branch, and no Desktop path selects 3.9 anyway (install.sh:2048 defaults 3.13/3.12, install.ps1:3882 ranks 3.13/3.12/3.11).

Evidence

Six platforms, base arm and head arm on each, installing no-torch-runtime.txt with --only-binary=:all: so a source build is a hard failure rather than a silent Rust compile:

runner machine base head
ubuntu-latest x86_64 ABSENT, http_get, the ValueError 1.6.0, xet_get, completed
ubuntu-24.04-arm aarch64 same same
windows-latest AMD64 same same
windows-11-arm ARM64 same same
macos-15 arm64 same same
macos-15-intel x86_64 same same

Locally: tests/studio/install 6897 passed / 32 skipped, the no-torch and shell guards 129 passed and 49/0, the Studio Xet suites 112 passed, ruff clean and a format fixed point. Reverting the requirement hunk and keeping the tests fails them, so they are not testing their own mocks.

One thing I could not prove: ppc64le, s390x, i686 and armv7l have no GitHub runner, so the source-build half of the marker argument rests on the missing wheels and the maturin sdist, not on a run. Separately, windows-11-arm cannot install studio.txt at all today (pandas and pyarrow publish no win_arm64 wheels); that fails identically with and without this PR.

Good fix, and the right one for #10840. Merging once CI is through.

@danielhanchen

Copy link
Copy Markdown
Member

Review record for #10849, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#52.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1 — reviewed mirror b752e6f45 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

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

Reviewed commit: b752e6f453

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror b752e6f45 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@danielhanchen
danielhanchen merged commit c052e1f into unslothai:main Sep 22, 2026
62 of 66 checks passed
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…#10849)

* fix(studio): bundle hf-xet for Desktop large Hub downloads

Declare hf-xet in studio and no-torch runtime requirements so AppImage
and GGUF-only installs (--no-deps) expose Xet transport instead of
falling back to HTTP and hitting huggingface_hub's large-file error.

* fix(studio): remove merge conflict markers from no-torch-runtime.txt

Leftover conflict markers broke uv pip parsing during --no-torch installs
and failed UI/GGUF/API CI on the requirements file at line 51.

* test(studio): assert hf-xet pins are Python 3.10+ only

* Gate the hf-xet pins on the machines it ships wheels for, and raise the floor to the hub's

The pins arrived marked on python_version only. huggingface-hub gates its own hf-xet dependency on
platform_machine as well, and for a reason this file knows: no-torch-runtime.txt installs --no-deps,
so a machine with no hf-xet wheel resolves the sdist, which builds through maturin and needs a Rust
toolchain. That is the same failure the neighbouring hf_transfer, sqlite-vec and pymupdf lines are
marked against, and .github/scripts/clean-machine-assert.sh fails the clean-machine lane on it.

Checked against the index rather than copied: hf-xet 1.6.0 publishes wheels for x86_64, aarch64,
win_amd64, win_arm64, macOS arm64 and musllinux, and none for ppc64le, s390x, i686 or armv7l -- the
arches install_python_stack.py:414 already calls out as having no torch wheel either, which is
exactly how a user reaches the no-torch path. ARM64 is added on top of upstream's five because the
win_arm64 wheel does exist, so Windows on ARM gets Xet rather than the 50GB HTTP refusal.

Floor raised 1.5.1 -> 1.5.2, which is what huggingface-hub 1.32 declares. Under --no-deps nothing
reconciles the two, so the lower pin could leave an env whose hub asks for more than it has.

The test asserted presence and three python_version evaluations, leaving platform_machine to the
host, so it read x86_64 on every runner and said nothing about the case above. It now evaluates
full marker environments across wheeled and unwheeled machines, checks the floor excludes the
versions below it, and covers all four declarations instead of two. Its 3.9 rationale was also
wrong: hf-xet ships cp38-abi3 wheels and supports 3.9. The >=3.10 split stays because it mirrors
the huggingface-hub 0.36.2 branch and no Desktop path selects 3.9, which is what it now says.

* Tighten the hf-xet comments to the facts that are not in the line itself

---------

Co-authored-by: Daniel Han <[email protected]>
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.

[Bug] Unsloth Desktop Appimage is missing a package. Cannot download larger models as a result.

2 participants