Repository navigation
Unsloth Studio / Desktop: colour a companion download's bar by model, text encoder and VAE - #13112
Conversation
… text encoder and VAE
…gend so a thin VAE segment doesn't overlap its neighbour
…text encoder and VAE
…resumed download already had
…ow of a staged download
- The Hub download queue runs the checkpoint first and drops unticked
assets, so the bar's earlier/later parts are now worked out from that
final list. Before, a plan that listed the encoder repo first showed the
encoder as already done while the GGUF was still at 0.1 GB.
- A weights file at the repo root (a hosted prequant such as
Qwen-Image-2.1-FP8.safetensors) counts as the model, not the text
encoder.
- family-override.test.ts loads diffusion-pipeline-load-target.ts through
the bundler resolver now that it imports via `@/`, and its source check
matches the new `{ ...opts, checkpointBytes }` call.
- download-breakdown.test.ts passes `tsc -p tsconfig.test.json`.
… parts - A checkpoint entry the plan stages with no bytes (an older snapshot already holds the GGUF) no longer hides the cached model segment on the companion rows. - ae.safetensors, FLUX.1's VAE picked as a root-level override, counts as the VAE instead of the model.
|
On the final head, the companion download bar splits into model, text encoder and VAE parts, and the parts fill in the order the files actually download. What changed
The frontend suite, typecheck, build and bundle check pass on Unsloth Studio download panel, before at merge base Open product questionEarlier in this thread, the preference was to keep separate model, text encoder and decoder rows (the existing multi-row download UI) rather than one split bar. That needs a decision before this lands. One reuse option: when one repo supplies both the encoder and the VAE, stage them as two entries so they appear as the existing "Text encoder" and "Decoder & configuration" rows and the bar needs no colours. If the split bar stays, there are a few design points: it uses raw Tailwind amber/blue/emerald instead of theme tokens; amber already means "warning" on the same bar; the amber and emerald legend text at 10.5px is below 4.5:1 contrast on white; and the legend's lowercase "model" / "text encoder" differs from the "Text encoder" casing elsewhere in the panel. |
|
@codex review |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de570e1f12
ℹ️ 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".
| bytes: int = Field( | ||
| 0, description = "Declared size of the files still missing from cache, 0 when unknown" | ||
| ) | ||
| file_bytes: Dict[str, int] = Field( |
There was a problem hiding this comment.
Populate file sizes for native sd.cpp image plans
On hosts where /images/download-plan selects get_sd_cpp_backend() (the GPU-less/native sd.cpp path), SdCppBackend.download_plan() still creates every entry without file_bytes. This default serializes those entries with {}, and useStagedDownload only attaches a breakdown for a nonempty map, so image downloads that consist of a GGUF plus single-file encoders/VAE always keep the old single bar; populate the per-missing-file sizes in that planner too.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Scope extension, not a bug: an sd.cpp plan without file_bytes keeps the single bar exactly as before, which is the documented fallback.
| "repo_id": repo, | ||
| "files": names, | ||
| "bytes": sum(size for _name, size in staged), | ||
| "file_bytes": {name: int(size) for name, size in staged}, |
There was a problem hiding this comment.
Populate file sizes for native MiniMax-H3 plans
For a MiniMax-H3 GGUF pick, VideoBackend.download_plan() returns through _h3_native_download_plan() before reaching this generic entry builder, and that native planner accumulates bytes without setting file_bytes. The response therefore contains an empty map and the frontend suppresses the breakdown, so H3's model, Qwen encoder, and VAE companion downloads do not receive the new segmented bar; mirror this per-file map in the native planner.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Scope extension, not a bug: a MiniMax-H3 plan without file_bytes keeps the single bar exactly as before, which is the documented fallback.
| /** The bar split by what each part of the download is, the cached model included. */ | ||
| function PartsBar({ parts }: { parts: DownloadPart[] }) { | ||
| const total = parts.reduce((n, p) => n + p.bytes, 0); | ||
| const widths = parts.map((p) => Math.max(2, (p.bytes / total) * 100)); |
There was a problem hiding this comment.
Guard segmented bars against zero-byte parts
When Hub metadata has unknown sizes, the new API legitimately supplies file_bytes values of 0; in a multi-entry plan, downloadParts() can still create two zero-byte kinds from earlierBytes/laterBytes and return them. Once the worker reports any downloaded bytes the bar is no longer indeterminate, and this division uses a total of zero, producing NaN% widths instead of a usable progress bar; skip nonpositive cross-job parts or fall back to the single bar when the aggregate size is zero.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d8cf44b: zero-byte parts are skipped, so a plan with unknown sizes keeps the single bar; test added.
|
@codex review |
1 similar comment
|
@codex review |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8cf44bb9d
ℹ️ 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".
| const VAE = /vae|decoder|codec|vocoder|(^|\/)ae\.safetensors$/i; | ||
| // A weights file at the repo root is a single-file pick, the model itself: a hosted prequant such as | ||
| // `Qwen-Image-2.1-FP8.safetensors` names no transformer/ folder. Encoder prequants there say text_encoder. | ||
| const MODEL = /transformer|unet|\.gguf$|^[^/]+\.(safetensors|pt|pth|bin)$/i; |
There was a problem hiding this comment.
Recognize nested single-file checkpoints as model bytes
When a supported Hub single-file checkpoint is below a directory (for example split_files/diffusion_models/dit.safetensors, a shape exercised by the backend's single-file path), this pattern does not match it because it only accepts transformer/unet, GGUF, or root-level weights. partOf() consequently adds the selected denoiser's bytes to the text-encoder segment, so these downloads show no model segment and can label most of the transfer as text encoder; classify checkpoint entries explicitly or recognize nested denoiser paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 663c61d: files under diffusion_models/ or checkpoints/ now count as the model; test added.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 663c61d951
ℹ️ 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".
| const checkpointDownloads = entries.some( | ||
| (e) => e.checkpoint && Object.keys(e.fileBytes ?? {}).length > 0, | ||
| ); |
There was a problem hiding this comment.
Handle partially cached multi-file checkpoints
When a Wan 2.2 dual-expert pick has only one checkpoint file cached, VideoBackend reports checkpoint_bytes for both experts but fileBytes only for the missing expert. This all-or-nothing check either drops the cached expert when the selected file is missing, or adds the full two-expert size on top of the missing partner when the selected file is cached (checkpoint is then false), so the model segment is respectively too small or double-counted; compute the cached checkpoint contribution from the missing checkpoint bytes rather than just testing whether any checkpoint file is staged.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Below the bar: it needs a Wan 2.2 pick with exactly one of its two experts cached, and the effect is a segment width in a progress legend; the byte counter and the download are unaffected.
| checkpointBytes && checkpointBytes > 0 && !checkpointDownloads | ||
| ? entries.findIndex((e) => !e.checkpoint) | ||
| : -1; | ||
| const merged = (list: T[]) => Object.assign({}, ...list.map((e) => e.fileBytes ?? {})) as Record<string, number>; |
There was a problem hiding this comment.
Preserve duplicate filenames across repositories
When two staged repos use the same relative filename—supported component overrides can both be owner/repo/model.safetensors—this Object.assign overwrites the earlier entry's size. On a plan with checkpoint plus text-encoder/VAE override repos, the checkpoint row's laterBytes omits one entire asset, and rows after both repos do the same, so segment widths and totals are wrong; retain repo identity or sum collisions instead of flattening maps by filename.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in dc47781: same-named files from different repos are summed; test added.
| // A weights file at the repo root is a single-file pick, the model itself: a hosted prequant such as | ||
| // `Qwen-Image-2.1-FP8.safetensors` names no transformer/ folder. Encoder prequants there say text_encoder. | ||
| // ComfyUI-layout single-file picks sit under diffusion_models/ or checkpoints/ (diffusion_content.py). | ||
| const MODEL = /transformer|unet|diffusion_models\/|(^|\/)checkpoints\/|\.gguf$|^[^/]+\.(safetensors|pt|pth|bin)$/i; |
There was a problem hiding this comment.
Carry component roles instead of inferring filenames
When a valid text_encoder_file or vae_file override has a generic Hub filename such as model.safetensors, the backend assigns its role from tensor contents, but this root-level-weight pattern makes partOf() classify it as model. These supported overrides therefore inflate the model segment and remove the actual encoder/VAE segment; carry the planner's component role in the breakdown rather than relying only on names.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Below the bar: it needs a manual component override published under a generic file name, and only the legend colour moves. Carrying planner roles end to end is a separate refactor.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |


When Run fetches an image or video model's companions, the download panel shows one bar for everything. For Qwen-Image-2.1 Q2_K that's a 2.5 GB GGUF, 18 GB of text encoder and 1.4 GB of VAE behind a single percentage, so there's no way to see which part is taking the time.
This splits the companion bar into three segments: model (amber), text encoder (blue) and VAE (green). Each segment fills as its files arrive, with a legend underneath giving each part's size. A download that is all one kind of file, like the GGUF on its own, keeps the single bar.
How
file_bytes, the declared size of each file counted inbytes(diffusion.py,video.py,DiffusionDownloadPlanEntryinmodels/inference.py). The plan used to give one total per repo, and the text encoder and VAE usually come from the same repo, so the frontend couldn't tell 18 GB from 1.4 GB. A planner that doesn't fillfile_bytesleaves it empty and the panel shows one bar, as before.download-breakdown.tssorts each file into model, text encoder or VAE. Tokenizer, scheduler andmodel_index.jsoncount as text encoder, so there are always at most three parts. The job's single byte count is spread over the files in name order, sincesnapshot_downloadwithmax_workers=1fetches them one at a time in that order.Tests
Windows 11, tester PC (RX 6500 XT + RX 5700 XT, ROCm build).
test_diffusion_backend.py -k download_plan(measured at9d8f52f)tests/download-breakdown.test.ts(ate126c93)tsc -bThe 4 backend failures are the same tests on both sides: hosted-prequant and NVFP4 rung picks that resolve differently on this AMD box (
'mxfp8' == 'nvfp4'). The three commits after9d8f52fonly touch the frontend, so the backend counts weren't re-run.The screenshots and GIF come from a real download with this branch's backend and frontend, in Unsloth Studio on
127.0.0.1. The before is the released Unsloth Desktop 0.1.903 on the same download. The Desktop shell can't show the after yet, because it starts its own backend from the installed release, which doesn't sendfile_bytes.Not tested: macOS and Linux, and the video page's download, which shares the same plan fields but wasn't run.
Before / after (merge base vs head f5855a0)
Two isolated Studio installs on Linux, same purged HF cache, Run on
unsloth/Qwen-Image-2512-GGUFQ2_K. The panel is shot while the companion base repo downloads. Before: one bar. After: model 7.3 GB, text encoder 17 GB and VAE 254 MB segments with a legend, same 17 GB total.Also in this branch:
f5855a0counts LTX-2'svocoder/files as VAE (they were falling through to text encoder on the video page).