Skip to content

Studio: keep loading a downloaded retired FLUX.3 full copy from disk - #14835

Merged
danielhanchen merged 12 commits into
mainfrom
studio-flux3-retired-copy-offline
Oct 25, 2026
Merged

danielhanchen merged 12 commits into
mainfrom
studio-flux3-retired-copy-offline

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

#14173 sends every load of unsloth/flux-3-image-klein and unsloth/flux-3-image-klein-base to the BFL base they copy, which Studio then fetches from the -FP8 repo. That includes a snapshot of the copy that is already downloaded. The copies were retired for size (about 43 GB of the gated BFL repo, which the -FP8 repo now hosts for Studio). Their files are fine: the bf16 transformer, text encoder and VAE are the base's own. So the redirect broke installs that already hold a complete copy:

  • Offline, the base's mirror is not in the cache. The load reads modular_model_index.json through hf_hub_download(local_files_only=True) and fails with LocalEntryNotFoundError, even though the model is on disk.
  • Online, the same bf16 weights are downloaded a second time under the mirror's repo key.

This change keeps a copy that is complete on disk loading from disk, and redirects everything else as before:

  • retired_copy_loads_from_disk (diffusion_families.py): true for a snapshot path, or the copy's id with its refs/main snapshot in the live HF cache, when the folder passes the same FLUX.3 completeness check the load route applies (local_pipeline_components_are_complete with FLUX3_COMPONENT_FOLDERS). As the companion base of another single file, which supplies the transformer, the copy needs only the transformer config. Local stat only, no network.
  • DiffusionLoadRequest skips the redirect for such a copy (model_path and base_repo). Its root model.safetensors pick loads as the copy's own pipeline (the same weights): in the HF cache that file is a symlink into blobs/, which the single-file path check refuses. An incomplete or absent copy, a named id with nothing cached, and every other pick are redirected exactly as in Studio: load the retired FLUX.3 full copies through their base #14173, and a pipeline redirected to the base also redirects a base_repo that names the incomplete copy.
  • Media auto-switch: _retired_copy_as_base leaves a complete downloaded copy as its own pick, so the switch neither plans nor waits for the mirror, and the load keeps its snapshot path (by id only the active cache is searched, so a copy in an earlier Models folder would be redirected). An incomplete one is still switched as the base.
  • Images page: a retired-copy pick (the On Device row's repo id, or a snapshot path) is no longer redirected before the backend sees it. It is planned like a Hub pick: a complete copy plans nothing and loads from disk; an incomplete one is redirected by the backend, so the plan stages the base's files first. Reapply and the remembered model take what the load reported (retiredSnapshotAsLoaded), including after a page reload mid-load.

Offline, with the copy's real file layout in the cache (real JSON, placeholder weights), a load by its id reads everything from the snapshot; the only Hub call is a non-fatal size lookup.

Testing

  • tests/test_flux3_retired_copy_on_disk.py (new): a complete snapshot, by path with or without the display id, stays on the snapshot. With HF_HUB_OFFLINE=1 and every Hub lookup raising LocalEntryNotFoundError, the loader reads its manifest from disk with 0 Hub lookups. On main it is redirected and the lookup fails. The root model.safetensors pick stays on the snapshot. The copy named by id stays when its cached snapshot is complete. An incomplete snapshot, a root-transformer pick missing its file, and a copy that is not on disk at all are still redirected to the base. 4 of these fail on main and all 7 pass here.
  • Also in that file: the root pick of a snapshot laid out as the HF cache stores it (symlinks into blobs/) passes the route validator, the auto-switch keeps a copy in an earlier Models folder on its snapshot, and a pipeline redirected to the base does not keep an incomplete copy as its base_repo. These fail before the fix.
  • tests/test_media_auto_switch.py::test_a_complete_downloaded_retired_flux3_copy_switches_to_itself (new): the switch loads the snapshot without planning the base. On main it is refused with a 409 "not fully downloaded" for the base. The existing incomplete-copy switch test is unchanged and passes.
  • studio/frontend/tests/image-retired-full-copies.test.ts, image-load-resume.test.ts: retired-copy picks (id or snapshot) are planned and not redirected up front, and a load that went through the base, or loaded a root pick as the pipeline, is remembered as what it loaded as, also when recovered after a reload.
  • Existing suites: test_flux3_retired_full_copies.py, test_media_auto_switch.py, test_diffusion_routes.py, test_diffusion_flux3.py, test_local_model_format.py pass.

Not covered: a real image generation from the copy. That needs the roughly 43 GB checkpoint and a GPU; routing was checked with the copy's real configs and placeholder weights.

Before / after

Offline Studio (HF_HUB_OFFLINE=1) with a downloaded unsloth/flux-3-image-klein in its cache, picked from the Images page On Device list. Before, the page sends black-forest-labs/flux-3-image-klein, whose mirror is not cached, so the load fails. After, it sends unsloth/flux-3-image-klein and the load reads the snapshot on disk; it stops here only because the test cache holds placeholder weights.

Images page, offline: before vs after picking the downloaded copy

The copies were retired for size, not for their files. A copy complete on
disk (snapshot path, or the id with a complete cached snapshot) is no longer
redirected to its base, which offline raised LocalEntryNotFoundError and
online downloaded the same weights again from the -FP8 mirror. Incomplete or
absent copies still load through the base.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-25T08:09:13.782817Z 151a430 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[bot]

This comment was marked as resolved.

danielhanchen added a commit that referenced this pull request Oct 23, 2026
… in #14822 (#14852)

pre-commit.ci fails `ruff-format-with-kwargs` again on PRs queued after
00:36 UTC (#14834, #14835, #14836, #14842, #14845):
`studio/backend/tests/test_video_stream_encode.py` was merged in #14822
without the formatter, so every PR's all-files run rewrites it.

Same class as #14817. `python scripts/run_ruff_format.py` (the hook's
entry point, `ruff==0.6.9`) applied to that one file. The AST is
identical before and after, `ruff check` passes, and a full run of the
hook over every tracked Python file on this branch changes nothing else.
…snapshots

The root model.safetensors pick of a complete retired copy stayed on disk
but named no companion base, so the loader assembled it around the family
default (the base's -FP8 mirror): absent offline, a second download online.
The copy is now that pick's base_repo unless one was named.

A downloaded snapshot of a retired copy went straight to the load, but only
the backend knows whether it is complete; an incomplete one is redirected
to the base and pulled inline, outside the download plan. Such picks are
now planned by their path (with the copy as the display id), so the plan
reaches the same verdict and stages the base's files first.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…onfig, id loads need refs/main, and a redirected snapshot is remembered as its base

[skip ci]
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: fd7bb07ec3

ℹ️ 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 25, 2026
# Conflicts:
#	studio/frontend/src/features/images/images-page.tsx

[skip ci]
…ne, keep it on its snapshot in the auto-switch, and redirect an incomplete pipeline base

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 5a33eeae22

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 25, 2026
…ick loads from disk instead of redirecting its id up front

[skip ci]
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 151a430e5f

ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 25, 2026
@danielhanchen
danielhanchen merged commit d72ad8d into main Oct 25, 2026
56 of 65 checks passed
@danielhanchen
danielhanchen deleted the studio-flux3-retired-copy-offline branch October 25, 2026 10:19
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.

1 participant