Skip to content

Studio: download files over 50GB from ModelScope over HTTPS (#15989) - #15994

Merged
danielhanchen merged 9 commits into
unslothai:mainfrom
indrajeetapache:fix/modelscope-xet-50gb-15989
Oct 30, 2026
Merged

danielhanchen merged 9 commits into
unslothai:mainfrom
indrajeetapache:fix/modelscope-xet-50gb-15989

Conversation

@indrajeetapache

@indrajeetapache indrajeetapache commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #15989

With ModelScope as the model source, any file over 50GB (for example UD-IQ1_M/...-00005-of-00005.gguf in unsloth/DeepSeek-V4.1-Flash-1017-GGUF, 110.6GB) could not be downloaded. Studio's ModelScope adapter offers no Xet, and huggingface_hub refuses plain HTTPS transfers above MAX_HTTP_DOWNLOAD_SIZE (50GB). That limit is a client-side check in http_get, not a ModelScope limit: ModelScope's CDN answers range requests anywhere in the 110.6GB shard with a 206.

  • While ModelScope is the source, the backend no longer applies the 50GB HTTPS ceiling, and the download worker lifts the hub's client-side check (constants.MAX_HTTP_DOWNLOAD_SIZE).
  • Xet is reported as unavailable under ModelScope, so Auto, Xet and HTTP all resolve to HTTP there. Its partials are then labeled HTTP and stay resumable.
  • Hugging Face source behaviour is unchanged: the hub's check and the HTTPS ceiling stay in place.
  • Switching the model source drops the frontend's cached transport verdict and refreshes the mounted Settings row and hub toggle, since Xet availability now depends on the source.

Test plan

  • pytest studio/backend/tests/test_hub_download_http_size_ceiling.py: 51 passed on Linux, macOS and Windows; 4 of the new tests fail on the merge base.
  • Real ModelScope, the 110.6GB shard via the real adapter and huggingface_hub 1.33: base fails with ValueError: The file is too large to be downloaded using the regular download method; head streams it, is killed, and resumes from the same offset.
  • MAX_HTTP_DOWNLOAD_SIZE is read at call time in huggingface_hub 0.36.2, 1.32.0, 1.33.0 and 2.4.0.
  • Frontend: tests/download-transport-source-switch.test.ts (fails without the source-switch refresh), full npm test and npm run build pass.

Before / after

Settings > General > Downloads with ModelScope as the model source (merge base 8cb9120 vs f6cc0c8). Before, Xet stays selectable and Auto claims Xet; after, Xet is disabled and Auto names HTTPS with the reason.

Download transport row with ModelScope as the source, before and after

ModelScope's HF_ENDPOINT adapter does not serve Hugging Face Xet token
endpoints (HTTP 405). Oversized GGUFs then fell through to HTTPS and hit
huggingface_hub's 50GB ceiling with a misleading hf_xet install hint (unslothai#15989).
Mark Xet unavailable while ModelScope is the source so Auto uses HTTPS for
normal files and oversized jobs refuse with a switch-to-Hugging-Face message.
@Lyxot Lyxot self-assigned this Oct 30, 2026
Lyxot added 2 commits October 30, 2026 16:23
huggingface_hub's 50GB limit is a client-side check in http_get written for Hugging Face's storage; ModelScope's CDN serves these files, so refusing them left the download impossible rather than clearer. The ModelScope worker now lifts the check and the backend stops applying the ceiling while ModelScope is the source. Hugging Face behavior is unchanged.
@Lyxot

Lyxot commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

I pushed a change that replaces the refusal with a working download, and merged latest main (the branch was 64 commits behind).

Why: huggingface_hub's 50GB limit is a client-side check in http_get, not a limit on ModelScope. Its CDN answered a range request at byte 110,000,000,000 of the 110.6GB shard with a 206. That shard, UD-IQ1_M 00005, is the file that stopped the reporter after 00004.

What changed:

  • While ModelScope is the source, the backend no longer applies the 50GB ceiling, and the download worker lifts the hub's check.
  • Xet stays marked unavailable under ModelScope, as this PR proposed, so Auto, Xet and HTTP all resolve to HTTP.
  • The "switch to Hugging Face" message and its tests are gone. New tests are in test_hub_download_http_size_ceiling.py.
  • Hugging Face source behavior is unchanged.

Checked against real ModelScope, without a full download: the real worker streamed that shard, was killed, then resumed from the same offset (macOS). Only the disk-space check was faked. No complete 110GB transfer has been run.

The PR title still describes the old refusal.

@Lyxot

Lyxot commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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 ⚠️ Failed 2026-10-30T08:41:48.116600Z
We couldn’t complete this review. Comment @codex review to try again.
d97a3d1 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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 self-assigned this Oct 30, 2026
@danielhanchen danielhanchen changed the title Studio: refuse Xet under ModelScope so >50GB downloads fail clearly (#15989) Studio: download files over 50GB from ModelScope over HTTPS (#15989) Oct 30, 2026
@shimmyshimmer

shimmyshimmer commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

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

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 0f665e06b (no equivalent commit found on this PR)

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

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 0f665e06bb

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 0f665e06b (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.

Xet availability now depends on the source (ModelScope has none), so a
verdict cached under one source must not answer for the other.

[skip ci]
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…16108)

Since #16031 (test-launch sd.cpp binaries without the Windows
missing-DLL box), the AV shapes lint finds a new error on main. Every
PR's `Source lint` job and the
`test_lint_av_shapes.py::test_the_repository_is_clean_against_its_baseline`
test in the CPU shards fail on it, for example on #16018 and #15994:

```
studio/backend/tests/test_sd_cpp_probe_error_mode.py:221: [AV009] error: copies a Windows system binary
    line: shutil.copy(getattr(sys, "_base_executable", sys.executable), binary)
1 new error(s).
```

`test_a_real_binary_missing_its_dll_is_reported_unrunnable` copies
`python.exe` into `tmp_path` as `sd-server.exe`, away from
`pythonXY.dll`, and cuts `PATH` to System32. The result is a real PE
whose loader fails with `STATUS_DLL_NOT_FOUND`, the same failure as an
sd.cpp ROCm build without HIP. The lint's suggested replacement,
`windows_console_stub.py`, links nothing and starts fine, so it cannot
produce that failure. The copy has to stay. The lint documents this
route for that case: the finding is recorded in
`scripts/av_shapes_baseline.json` with the reason. The entry carries the
digest of that one line, so any other copy in the file is still a new
error.

I did not use `--update`. It would also have pruned many unrelated stale
entries across the baseline. This adds the one group (9 lines).

The CI message also prints an AV010 warning for
`.github/workflows/studio-tauri-smoke.yml:374` first, but warnings do
not fail the check. With only this entry added, the test passes.

## Verification

- `python scripts/lint_av_shapes.py`: `1 new error(s)` on main, `0 new
errors` here.
-
`tests/security/test_lint_av_shapes.py::test_the_repository_is_clean_against_its_baseline`:
fails on main on the AV009 line, passes here. The rest of the file
passes (19 passed).
- `--self-test` still passes, since the lint is unchanged.
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…zoo 2026.10.10 (#16114)

`pip scan-packages :: studio` (and `:: extras`) now fails on every PR
whose closure resolves torch 2.15.0 (released 2026-10-28) or botocore
1.43.122 (released 2026-10-29), and `pip scan-packages :: hf-stack` on
every PR that resolves unsloth-zoo 2026.10.10 (released 2026-10-28).
Examples are #16109 and #15994 in staging:

```
Summary: 1 CRITICAL, 4 HIGH
  HIGH      torch  torch/_inductor/compile_worker/subproc_pool.py   same matched code, file digest outside the pin
  HIGH      torch  torch/_inductor/standalone_compile.py            same matched code, file digest outside the pin
  HIGH      torch  torch/_precompile.py                             1 matched line(s) appended to a reviewed file
  CRITICAL  torch  torch/testing/_internal/common_utils.py          the flagged code was rewritten
  HIGH      torch  torch/_vendor/quack/epilogue/library.py          (new site)
  CRITICAL  botocore  botocore/httpsession.py                       the flagged code was rewritten
```

I read each site in the shipped file. For torch I checked the v2.15.0
sources against the wheel's pinned file digests, and for botocore I read
the 1.43.122 wheel.

| Site | What the scanner matched | Verdict |
|---|---|---|
| `torch/_inductor/compile_worker/subproc_pool.py` | `time.sleep(3600)`
and `subprocess.Popen(` of the compile workers, byte-identical to the
reviewed entry. Only the lines moved, so the pinned file digest changed.
| benign, new pin |
| `torch/_inductor/standalone_compile.py` | `exec(compile(python_code,
"<compile_to_python>", "exec"), namespace)`, identical to the reviewed
entry and one line lower. | benign, new pin |
| `torch/_precompile.py` | The same `exec(compile(python_code,
"<precompile>", "exec"), module_ns)`, plus one more commented usage
example `# exec(open("this_file.py").read(), ns)`. | benign |
| `torch/testing/_internal/common_utils.py` | The DOTALL reverse-shell
pattern spans the file from `import socket` on L32, so any edit moves
its digest; every torch release has had its own entry. The only socket
use is `find_free_port`, which binds `localhost:0` and returns the port.
"connect" appears only in error strings, and there is no `dup2`,
`pty.spawn`, `/bin/sh` or `webbrowser`. | benign |
| `torch/_vendor/quack/epilogue/library.py` (new) | `_gen_epi_fn`
compiles and execs a generated epilogue `def`. `params` and `body` are
fixed fragments chosen by boolean flags, and `activation` is only a key
into a fixed map. The file documents the reason: the generated signature
lets absent operands compile out of the kernel. Nothing external reaches
the source. | benign |
| unsloth-zoo `compiler.py` | One matched line was added:
`compile(looped, "<peft lora forward>", "exec")` in
`_patch_lora_update`. It checks that PEFT's own forward source still
parses after a string replacement, then falls back if it does not. The
code object is discarded and nothing is executed. The other matched
lines are unchanged. | benign |
| unsloth-zoo `llama_cpp.py`, `mlx/loader.py`, `mlx/speculative.py`,
`temporary_patches/moe_utils.py`, `vllm_utils.py` | Byte-identical
matched code. Only the pinned file digest moved. | benign, new pins |
| `botocore/httpsession.py` | The env read is the opt-in `SSLKEYLOGFILE`
TLS key log. The `conn.urlopen(...)` call gained
`enforce_content_length=False` and an optional per-request timeout
through `extra_kwargs`. | benign |

## Change

I added the new entries (six for torch and botocore, six for
unsloth-zoo) next to the existing ones for each file and removed
nothing. The earlier entries stay, so shards that still resolve older
torch and botocore are unaffected. I did not regenerate with
`--write-baseline`: it writes only what the current scan sees, so a
partial scan would have dropped every other package's entries. The
pinned sites keep pins (`file_sha256`) at their new file digests.

dnspython 2.9.1 also showed up in one run, but it scans clean on its own
against this baseline, so it needs no entry.

## Verification

- `scripts/scan_packages.py torch==2.15.0`: on main `1 CRITICAL, 4 HIGH`
with exit 1, the same result as the CI runs. On this branch it exits 0.
- `scripts/scan_packages.py botocore==1.43.122`: on main `1 CRITICAL`
with exit 1. On this branch it exits 0.
- `scripts/scan_packages.py unsloth-zoo==2026.10.10`: on main `1
CRITICAL, 5 HIGH` (the CI hf-stack result). On this branch it exits 0.
- The tests that read the scanner or its baseline: 638 passed.
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…load (#16130)

## Problem

`Frontend build + bundle sanity` fails intermittently at the `Titlebar
modal blur and window controls (Chromium)` step on unrelated PRs (seen
on #15994, #16091 and the staging run for #16109). Every time it is the
same shape: all modal checks pass, then the final `assert not errors`
trips on

```
504: http://127.0.0.1:5491/node_modules/.vite/deps/sonner.js?v=...
504: http://127.0.0.1:5491/node_modules/.vite/deps/zustand.js?v=...
```

with no page error logged. The smoke records every script, stylesheet or
font response at 400 or above. When the Vite dev server re-optimizes its
dependencies mid-load, it answers in-flight requests for the replaced
pre-bundles with `504 Outdated Optimize Dep` and then reloads the page.
That response is Vite's reload signal, not a missing asset, and the page
checks after it pass. It depends on runner timing, so it does not
reproduce on demand (a cold cache and the CI step order both passed
locally).

## Fix

- `tests/studio/_playwright_robust.py`: `is_vite_outdated_dep(response)`
matches exactly status 504 with the status text `Outdated Optimize Dep`.
Vite's other 504, `Optimize Deps Processing Error`, is a real failure
and still counts.
- `tests/studio/playwright_titlebar_blur.py`: the asset response guard
skips only that response. A 404, a 500 or a processing-error 504 is
still recorded and still fails the smoke.
- `tests/studio/test_vite_outdated_dep.py` pins this:
  - the predicate's truth table;
- that the smoke's guard keeps the exemption as a single `and not ...`
term;
- that the installed Vite still sends that status text, so a rename
upstream shows up here instead of as a dead exemption.

## Verification

- New tests pass (8 passed, the Vite source check included).
- Sabotage:
- With the predicate reduced to `status == 504`, two rows fail (the
processing-error and gateway-timeout cases).
  - With the exemption removed from the smoke, the guard test fails.
- In a real Chromium page served by a small HTTP server, Playwright
reports `status_text == "Outdated Optimize Dep"` for the first response,
and the predicate is true only there. It is false for `Optimize Deps
Processing Error`.
- `python3 tests/studio/playwright_titlebar_blur.py` passes with the
change.
@danielhanchen
danielhanchen merged commit 3b9ad4d into unslothai:main Oct 30, 2026
54 of 115 checks passed
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.

[Bug] Model files larger than 50GB was blocked when ModelScope as Model source.

4 participants