Repository navigation
fix(studio): bundle hf-xet for Desktop large Hub downloads - #10849
Conversation
There was a problem hiding this comment.
💡 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".
| # 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): |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
55fd805 to
e6c9f54
Compare
Leftover conflict markers broke uv pip parsing during --no-torch installs and failed UI/GGUF/API CI on the requirements file at line 51.
|
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. |
…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.
|
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? |
|
@danielhanchen — Python < 3.10 is unchanged. Every Added |
27ae76c to
dcb66cc
Compare
…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.
|
Reviewed this end to end, and pushed two commits to the branch: a merge from The bug is real, and only one of the four lines fixes itBuilt two venvs the way the installer builds them ( Same result against a real Hub file: base downloads over HTTP with the
What I changed1. The pins carried no 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 There is a second consequence: 2. Floor raised 1.5.1 -> 1.5.2, which is what 3. The test. It asserted presence and three EvidenceSix platforms, base arm and head arm on each, installing
Locally: 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, Good fix, and the right one for #10840. Merging once CI is through. |
|
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
|
…#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]>
Fixes #10840
Problem
Unsloth Desktop (AppImage) can fail when downloading large GGUF quants with:
When
hf_xetis not importable, Studio downgrades Hub downloads to HTTP.huggingface_hubthen refuses many large / Xet-backed blobs withouthf_xet.GGUF-only installs apply
no-torch-runtime.txtwith--no-deps, sohuggingface_hubdoes not pullhf-xettransitively even though full installs often would.Fix
hf-xet>=1.5.1,<2.0instudio.txt,no-torch-runtime.txt, andsingle-env/constraints.txtstudioextra inpyproject.tomlVerification
pytest tests/studio/install/test_no_torch_runtime_hf_xet.py tests/studio/install/test_studio_extra_matches_requirements.py