Skip to content

Studio: stop listing a GGUF's borrowed text encoder and VAE as a model in the picker - #13778

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
LeoBorcherding:studio/companion-only-cache-row
Oct 15, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
LeoBorcherding:studio/companion-only-cache-row

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Loading a diffusion GGUF such as unsloth/Qwen-Image-2.1-Turbo-GGUF downloads only the companion files (text encoder, VAE, configs) from its base repo, Qwen/Qwen-Image-2.1-Turbo. The model picker's On Device tab then listed that base repo under "Other models" as a partial Safetensors row. Clicking it, or its settings gear, read it as an interrupted download: it fetched the 14 GB bf16 transformer and loaded the full pipeline, which runs out of memory on a 16 GB card. Reported in the Discord help thread.

#11644 already flags these rows as companion_prefetch, but only the Hub reads the flag.

Changes

  • use-chat-picker-inventory.ts: the picker skips companionPrefetch rows, the same way it already skips sd.cpp companion mirrors. The Hub still lists them, so their size stays visible and deletable.
  • inventory_scan.py: adds snapshot_denoiser_has_weights. cache_inventory.py and local_inventory.py stop flagging a snapshot as a prefetch when any denoiser shard is on disk. A full download that stopped part way is a torn download, not a prefetch. Before this, it would have been hidden by the new filter. It now stays listed, partial and resumable.

Tests

MacBook Pro M5, macOS 26, at 5e927b0fa3:

  • Backend: new tests for a torn denoiser (not flagged, still partial) and an interrupted denoiser download (resumable). The torn-denoiser tests fail on base and pass here; the interrupted-download test already passes on base, since base excluded downloads Studio marked as partial. Five test_delete_variant_* tests fail on base and on this branch alike, unrelated.
  • Frontend: a new check that the picker filter excludes companionPrefetch. It fails on base and passes here, and tsc -b is clean.

Not tested: a live Unsloth Studio run with a real Turbo GGUF download.

Screenshots

Seeded cache: Qwen/Qwen-Image-2.1-Turbo as a companion-only base (only the text encoder, VAE and configs, as a GGUF load leaves it) and Tongyi-MAI/Z-Image-Turbo as a torn full download (index plus 1 of 3 shards). Left is main, right is this PR.

Images picker, On Device: the companion-only base is gone, the torn download stays listed and resumable.

Images picker before and after

Chat picker, On Device: same.

Chat picker before and after

The Hub still lists both rows, so the companion files stay visible and deletable.

Additional checks

  • Base repo layouts for Qwen-Image-2.1-Turbo, FLUX.2-klein, Z-Image, LTX and SDXL-style unet/ bases are flagged as a prefetch; a base repo the user also downloaded in full is not, and stays listed.
  • Sharded .safetensors, .bin and *.index.json under the denoiser all count as weights, so a torn full download stays partial and resumable.
  • CPU, merge base vs this branch: the related hub/tests files go from 8 failed / 580 passed to 5 failed / 583 passed (the three newly passing are this PR's tests); tests/ 2522 passed on both; frontend npm test differs only by the new picker test; tsc -b exits 0.
  • The five test_delete_variant_* failures exist on main too and are a test-only stub problem: _patch_variant_delete_side_effects stubs get_hf_cache_paths with a SimpleNamespace that lacks source, which known_hf_cache_homes() reads. Production code is unaffected; that belongs in a separate fix.

…l in the picker

The picker's On Device list showed the base repo a diffusion GGUF borrows its
companions from as a partial Safetensors row; a click fetched the full bf16
denoiser and loaded the dense pipeline. Filter companion_prefetch rows out of
the picker, and stop flagging a torn denoiser download as a prefetch so it
stays listed and resumable.
…ting transformer_2 weights

The companion prefetch skips only transformer/ (keeping its config.json), so judge torn vs prefetch
on transformer/ and unet/ alone, and count a shard index there too. Keeps latest_snapshot_dir lazy.
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-15T12:28:35.602636Z e929e69 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 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: f131fe681a

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

try:
root = Path(snapshot)
return any(
entry.name.lower().endswith((*_DENOISER_WEIGHT_SUFFIXES, ".index.json"))

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 Exclude config-prefetched UNet indexes from weight evidence

For a whole-pipeline single-file/GGUF whose base uses a sharded unet/, the normal companion prefetch includes unet/diffusion_pytorch_model.safetensors.index.json: core/inference/diffusion.py::_base_config_file_downloaded accepts this JSON while rejecting the referenced .safetensors shards. This broad .index.json match therefore makes the local inventory set companion_prefetch=false, so the Hub presents the config-only cache as an interrupted download and “Continue” fetches the full dense UNet. Distinguish indexes staged by the config prefetch (or stop staging them) from indexes that prove a user-started denoiser download.

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.

Fixed in e929e69. Under unet/ only a weight file now counts as evidence of a user-started denoiser download; a lone unet/.index.json is what the whole-pipeline single file's config prefetch stages, so that cache keeps companion_prefetch and the Hub no longer offers it as an interrupted download. A lone transformer/ index still counts, since the GGUF companion prefetch fetches only transformer/config.json there. Test: test_unet_index_staged_by_the_config_prefetch_is_not_weight_evidence (fails before, passes after); hub/tests otherwise unchanged (839 passed, the 5 test_delete_variant_ failures are pre-existing on main).

…ence

A whole-pipeline single file's config prefetch (_base_config_file_downloaded) stages unet/*.index.json beside the configs, so under unet/ only a weight file proves a user-started denoiser download. A lone transformer/ index still counts: the GGUF companion prefetch fetches only transformer/config.json there.

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: e929e69736

ℹ️ 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 merged commit 6a08610 into unslothai:main Oct 15, 2026
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