Skip to content

Stop a GGUF pick downloading the dense base transformer it never opens - #8232

Merged
danielhanchen merged 21 commits into
mainfrom
b8226
Aug 10, 2026
Merged

danielhanchen merged 21 commits into
mainfrom
b8226

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

The bug

Pick unsloth/Qwen-Image-Edit-2511-GGUF at Q6_K. Studio fetches the 16.85 GB GGUF you asked for, and then starts a 57.72 GB download of Qwen/Qwen-Image-Edit-2511. 40.86 GB of that second download is the dense transformer/, which the fast path then denoises with instead of the GGUF. So you pay for the quant you picked and for a full-precision denoiser you did not, and only the second one runs.

The download plan, on current main, with an empty cache:

entry unsloth/Qwen-Image-Edit-2511-GGUF   1 file    16.85 GB   (qwen-image-edit-2511-Q6_K.gguf)
entry Qwen/Qwen-Image-Edit-2511          33 files   57.72 GB   <- 7 of them transformer/, 40.86 GB
TOTAL                                               74.57 GB

After this change:

entry unsloth/Qwen-Image-Edit-2511-GGUF   1 file    16.85 GB   (qwen-image-edit-2511-Q6_K.gguf)
entry Qwen/Qwen-Image-Edit-2511          26 files   16.86 GB   <- no transformer/
TOTAL                                               33.71 GB

The remaining 16.86 GB is the text encoder, VAE, tokenizer and configs. Those are genuinely required and stay.

Why this shape of fix

The rule already exists, one branch above, for the hosted pre-quant checkpoint:

# A GGUF pick with the scheme left to us: the hosted pre-quant is free only while
# already cached, since fetching it means a SECOND multi-GB denoiser and the GGUF
# never runs.

The base repo's own transformer/ shards are the same purchase, and were not covered by it. This extends that rule to them rather than inventing a new one: when the pick is a GGUF, the scheme was left to us, nothing is being baked, and the dense shards are not already on disk, decline and keep the GGUF.

Both halves move together, because the plan and the loader have to agree:

  • _dense_quant_prefetch_needed declines, so the shards are never staged;
  • load_pipeline declines on the same verdict, carried as _transformer_prefetched. That half closes a hole of its own: _transformer_prefetched is False exactly when the plan left the shards out, and the dense path would then have pulled them with from_pretrained(subfolder = "transformer") under the load lock, after the previous pipeline was evicted, where unload cannot preempt it and progress has already reported 100%.

What "already on disk" means, because there are two of them

An explicit transformer_quant is opting in to the dense build and still buys it. A LoRA bake still needs it. The mirror is checked alongside the vendor id, so a gated base staged under the unsloth copy is not misread as uncached.

Beyond that, two different things can already be on disk, and only one of them is the dense base. Both keep the fast path, for free, exactly as before, but they are not the same test:

  • the dense base's own transformer/ shards are cached. _dense_transformer_cached answers that, the plan then stages them, and _transformer_prefetched is True at the load.
  • a hosted pre-quant checkpoint is cached. The branch above already clears that case, and it stages no transformer/ shards at all, because the small quantised checkpoint replaces them rather than a download being refused.

The second one is why the load side does not read an empty stage as a verdict on its own. _transformer_prefetched is False in both cases, for opposite reasons, so load_pipeline asks resolve_dense_quant_candidate which of the two the fast path would actually open, and declines only when the answer is the dense base. That is the same resolver the download plan and the memory re-plan already use, so the plan and the load stay on one answer.

Measured on a warm cache, unsloth/Z-Image-Turbo-GGUF at Q8_0 with unsloth/Z-Image-Turbo-FP8 already cached:

transformer_quant  fp8            reason "engaged on the dense fast path"
params             239 Float8Tensor, 282 Parameter, no GGUF tensors
resident           12.31 GB

which is what main does for that pick, unchanged.

The trade-off, which is the part worth arguing with

On a machine with room, an auto GGUF pick used to end up on dense bf16 + torchao, which the code says beats GGUF per-matmul dequant on speed and quality. After this it will run the GGUF unless the dense base, or a pre-quant checkpoint, is already cached. That is deliberate: 40.86 GB of unrequested download is a worse surprise than a slower denoise, and it is the same call the pre-quant branch already makes. If you would rather keep the upgrade and instead surface the cost up front, say so and I will invert it.

Verification

Reproduction and fix both measured against live Hub metadata, no weights downloaded, except the Z-Image case above which was loaded for real to read the resident tensors. Byte totals are from DiffusionBackend.download_plan with an isolated cache root.

The same Qwen-Image-Edit-2511 pick at BF16 shows the size independently: 98.59 GB staged before, 57.73 GB after.

Tests: 11 added, studio/backend/tests/test_diffusion_backend.py 216 -> 227. Three existing tests in the "an auto quant never buys a second denoiser" section stub the new cache verdict explicitly, since they are about the pre-quant rule and not this one. One failure in that file, test_load_refines_component_placement_after_text_encoder_quantization, is present on main unchanged and is not from this branch.

Mutation tested, 11 mutants, each caught by the named test, suite green after restoring, run on a git archive HEAD copy rather than the worktree:

mutation caught by
drop the uncached-dense-base decline (plan) test_auto_quant_declines_an_uncached_dense_base
_dense_transformer_cached ignores the mirror test_dense_transformer_cached_reads_the_mirror_too
let a cache read error escape test_dense_transformer_cached_survives_an_unreadable_cache
decline regardless of auto test_an_explicit_transformer_quant_still_buys_the_dense_base
drop the candidate re-ask, so an empty stage is a decline again test_an_unstaged_transformer_still_takes_a_CACHED_prequant
decline on the candidate alone, ignoring what the prefetch staged test_the_load_declines_when_the_prefetch_skipped_the_dense_shards
a resolver with no answer reads as a prequant test_a_resolver_with_no_answer_reads_as_the_dense_base
a raising resolver reads as a prequant test_a_raising_resolver_reads_as_the_dense_base
let the re-ask soften the uncached pre-quant branch above it test_an_uncached_prequant_still_declines_before_the_candidate_is_asked
allow the dense fallback once the prequant path is taken test_an_unstaged_prequant_load_still_forbids_the_dense_fallback
the plan widens for a prequant candidate test_the_plan_and_the_load_agree_on_a_cached_prequant

Full studio/backend/tests, run with --continue-on-collection-errors: the sorted FAILED/ERROR line set is identical before and after this branch's changes.

danielhanchen and others added 2 commits August 9, 2026 07:55
Picking unsloth/Qwen-Image-Edit-2511-GGUF Q6_K fetched the 16.85 GB GGUF and then
started a 57.72 GB pull of Qwen/Qwen-Image-Edit-2511, 40.86 GB of which is the
dense transformer/ the fast path would denoise with INSTEAD of the GGUF that was
just downloaded.

The rule this needs already exists one branch above, for the hosted pre-quant
checkpoint: an auto quant never downloads a second transformer for a GGUF pick,
because a cached shortcut is free and an uncached one costs a whole extra
denoiser that leaves the first unused. The base repo's own transformer/ shards
are the same purchase and were not covered.

So decline the same way when the base shards are not already on disk, in the
prefetch and in the loader alike. Nothing else moves: an explicit
transformer_quant is opting in and still buys the dense build, a LoRA bake still
needs it, and a user who already has the dense base still gets the fast path for
free.

The loader half also closes a hole of its own. _transformer_prefetched is False
exactly when the plan left the shards out, and the dense path would then have
pulled them with from_pretrained() under the load lock, after the previous
pipeline was evicted, where unload cannot preempt it and progress has already
reported 100%.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

# Conflicts:
#	studio/backend/core/inference/diffusion.py
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

Two measurements from testing a related report on z-image, both on a B200 with isolated cache roots. One confirms this PR's scope, one is a case I think it regresses.

1. The defect is family-specific in a way worth stating, and z-image is on the other side of it.

Same auto GGUF pick, empty cache, DiffusionBackend.download_plan against live Hub metadata:

unsloth/Qwen-Image-Edit-2511-GGUF  Q6_K
  auto scheme                      int8
  _uncached_prequant_repo          None            <- no hosted pre-quant for this family
  dense candidate                  prequant=False
  _dense_quant_prefetch_needed     True            <- 74.57 GB staged, exactly as you measured

unsloth/Z-Image-Turbo-GGUF         Q8_0
  auto scheme                      fp8
  _uncached_prequant_repo          unsloth/Z-Image-Turbo-FP8
  dense candidate                  prequant=True
  _dense_quant_prefetch_needed     False           <- 15.45 GB staged, GGUF + companions only

z-image declares prequant_repos, so the pre-quant rule one branch above already declines and the base transformer/ shards are never staged. Loading it for real on current main confirms it end to end: pipe.transformer holds 276 GGUFParameter weights, ggml types Q8_0 240 / BF16 36, 7.22 GB resident, hf_quantizer = diffusers GGUFQuantizer. The GGUF the user picked is what denoises. So the families that hit the bug this PR fixes are the ones with no hosted pre-quant, which is the set the existing rule cannot reach.

2. The load-side decline also turns off the CACHED pre-quant fast path, which I do not think is intended.

_transformer_prefetched is False for a pre-quant load too: the plan never stages transformer/ for one, because the pre-quant checkpoint replaces it. So the new elif not _transformer_prefetched fires on a pick that costs no extra bytes at all.

Measured, same cache root, unsloth/Z-Image-Turbo-FP8 already on disk, unsloth/Z-Image-Turbo-GGUF at Q8_0, everything left on auto:

main          transformer_quant = "fp8"    239 Float8Tensor weights, 0 GGUFParameter
              resolved.reason  "engaged on the dense fast path"

this branch   transformer_quant = None     276 GGUFParameter weights, 0 Float8Tensor
              resolved.reason  "not engaged (GGUF transformer loaded)"

The user who deliberately downloaded the pre-quant loses the build they downloaded it for, and the badge loses its explanation too: the new branch sets dense_declined without a transformer_quant_decline, so it falls through to the generic "not engaged" reason rather than saying why.

The description promises "a user who already has the dense base cached still gets the fast path, for free, exactly as before", and this is the same promise applied to the pre-quant. Gating the new decline on the pre-quant verdict being absent would keep it, something like only declining when _uncached_prequant_repo returned None and the candidate is not a pre-quant. Happy to be told this is deliberate.

Separately, the label the user sees is wrong on both paths regardless of which way this lands: the Loaded models row reads precisionLabel(status.dtype), and dtype is the pipeline compute dtype, so it prints BF16 for a Q8_0 GGUF and for an fp8 dense build alike. That is #8241 and does not overlap this.

…shards

The load-side decline added here fired whenever the prefetch staged no
transformer/ shards. That is the right verdict when the fast path's candidate is
the dense base, which is the case this branch exists to fix. It is the wrong one
when a hosted pre-quant checkpoint is already cached: that stages no shards
either, because the small quantised checkpoint replaces them, not because a
download was refused.

Measured on a warm cache, unsloth/Z-Image-Turbo-GGUF at Q8_0 with
unsloth/Z-Image-Turbo-FP8 on disk, loaded the GGUF instead of the fp8 checkpoint
that main loads for free.

Ask the resolver that actually picks between the two rather than reading an
empty stage as a decline: resolve_dense_quant_candidate is the same call the
download plan and the memory re-plan already use, so the plan and the load stay
on one answer. A None candidate stays 'dense', which is what the plan does too.

The branch above is untouched, so an uncached pre-quant is still declined.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed and fixed on the branch.

The decline was reading an empty transformer/ stage as a verdict. It is one when the fast path's candidate is the dense base, which is the case this PR exists to fix, but a cached hosted pre-quant stages no shards either, because the small quantised checkpoint replaces them rather than a download being refused. _transformer_prefetched was False in both cases, for opposite reasons.

load_pipeline now asks resolve_dense_quant_candidate which of the two the fast path would open, and declines only when the answer is the dense base. That is the same resolver _dense_quant_prefetch_needed and the memory re-plan already use, so the plan and the load stay on one answer: for a prequant candidate the plan returns False from candidate.prequant and the load takes the checkpoint, and for a dense candidate both decline.

Measured, warm cache, unsloth/Z-Image-Turbo-GGUF at Q8_0 with unsloth/Z-Image-Turbo-FP8 cached:

before  transformer_quant None   276 GGUFParameter    7.22 GB
after   transformer_quant fp8    239 Float8Tensor    12.31 GB   "engaged on the dense fast path"

which is what main does for that pick.

The original fix is unaffected. unsloth/Qwen-Image-Edit-2511-GGUF at Q6_K resolves a dense candidate, so it still declines: 74.57 GB on main, 33.71 GB here, with no transformer/ entries staged.

Three tests fail before this change and pass after, plus three more pinning the resolver's no-answer, error and uncached-prequant verdicts. 11 mutants, each caught by its named test, suite green after restoring. Full studio/backend/tests sorted FAILED/ERROR line set identical to the branch before the change, 89 lines either side.

The PR body's "exactly as before" sentence was wrong as written and now separates the two kinds of "already on disk".

danielhanchen and others added 4 commits August 9, 2026 12:03
…will use

A byte count above zero says a transformer download STARTED, not that it finished, so one shard
left by a cancelled pull read as a cache hit and widened the prefetch into the rest of it. And a
gated base and its ungated mirror are two independently addressed caches, so shards resident under
the upstream id spared nothing once the companion listing sent the fetch to the mirror. Both ended
in the multi-gigabyte second denoiser the branch exists to prevent.

The estimate now defers the widening to a callable and hands it the base repo's own listing, split
either side of transformer/. That is the one place both facts are knowable: the companions decide
which repo is fetched, and the shard names say whether that repo holds all of them.

Also: a complete local base directory counts as staged (nothing can be downloaded from a path, and
its empty Hub listing is not a refusal), and the resolver's free-disk gate no longer hides a cached
pre-quant, which downloads nothing and so is not what that gate is sized for.

@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: 02b77383e1

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

return False
try:
fetch_repo = prefer_ungated_mirror(base, files = companion_files)
return cache_holds_files(fetch_repo, transformer_files)

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 Require current-revision cache hits before widening

When a base repo is republished with the same transformer filenames, a machine that cached the old dense transformer still has every transformer_files path under its local refs/main; this verdict only checks names and is not tied to the model_info SHA that _estimate_download_bytes() just read. The fresh evidence is that the new helper introduced here passes only transformer_files, so _dense_transformer_cached() can return true for a stale revision, _estimate_download_bytes() widens the prefetch, and hf_hub_download then resolves current main and downloads the entire dense transformer again—the second-denoiser download this change is meant to avoid. Thread the current revision/etag into this cache check before widening, as the download-plan cache dropping code does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting, on how the cache actually stores a revision. Blobs are content addressed by etag and snapshots are symlinks into them, so a repo republished with the transformer UNCHANGED gives the new revision the same etags and hf_hub_download re-links the existing blobs without moving a byte. And if the shards genuinely changed, the new etags are the point: downloading them is the load doing what the user asked, not a second denoiser. Either way there is no spurious multi-gigabyte pull for the revision check to prevent. See https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache on the blobs/snapshots/refs layout.

Pinning the probe to the SHA model_info just read would also cost more than it saves. Base repos pick up README and config commits regularly, so a great many users sit one metadata commit behind with every shard already on disk; a SHA-exact check finds no snapshot directory for the current commit and declines the fast path for all of them. That is a common case traded for a corner. The download-plan cache-dropping code is revision exact for a different reason, since it decides which individual files to skip fetching, where being wrong costs correctness rather than speed.

@danielhanchen

Copy link
Copy Markdown
Member Author

Before/after from two isolated Studio installs, merge base f0ef75ec9 vs head 02b77383e, same scene on both: pick unsloth/Qwen-Image-2512-GGUF Q4_K_M on an empty cache and watch what gets staged.

The GGUF itself is downloaded on both sides, identical. The item under it is the companion base repo, and that is the whole difference: 4.3 KB / 58 GB before, 357 MB / 17 GB after.

The plan the panel is drawing:

before after
total 66.08 GiB 28.02 GiB
unsloth/Qwen-Image-2512-GGUF 12.34 GiB, 1 file 12.34 GiB, 1 file
unsloth/Qwen-Image-2512 53.74 GiB, 28 files 15.69 GiB, 17 files
dense transformer/ shards in that base 11 0

The 11 shards are the dense transformer the GGUF replaces, so the loader never opened a byte of them.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 02b77383e1

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

return False
try:
transformer = Path(base).expanduser() / "transformer"
return transformer.is_dir() and any(transformer.glob("*.safetensors"))

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 Recognize bin-only local transformer checkpoints

When a valid local Diffusers base stores its transformer as diffusion_pytorch_model.bin, this safetensors-only predicate returns false, so _run_load marks the transformer unstaged and an automatic dense quant unnecessarily falls back to the GGUF even though no second download is possible. The fresh evidence beyond the earlier local-base report is the supported bin-only checkpoint format; accept the weight formats that from_pretrained supports rather than requiring *.safetensors.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting, because admitting a .bin-only transformer here makes the outcome worse rather than better. The fit re-check downstream is _dense_transformer_resident_bytes, which reads safetensors headers and returns 0 for a .bin-only transformer, and its own docstring spells out the consequence: a base whose shards it misses skips the fit check entirely and lets the dense build OOM under a plan sized for the GGUF. Reading .bin as staged would walk straight into that. Declining costs the GGUF load, which is the safe side, and the whole preflight is already safetensors-only by construction.

Comment on lines +1942 to +1946
transformer_files = tuple(
f
for f in kept
if f not in skip and _base_file_downloaded(f, include_transformer = True)
)

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 redundant weight formats from the cache requirement

When a transformer directory publishes both safetensors and .bin weights, this list includes both formats even though Diffusers prefers safetensors (as the pipeline branch above already accounts for). A cache containing the complete safetensors checkpoint but not the unused .bin copy therefore fails _dense_transformer_cached, causing automatic quantization to be disabled despite all weights the dense loader would open already being resident; filter the listing to the format that from_pretrained will select before requiring every file.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting. The requirement is exactly the list _prefetch_files stages: base_files comes from _base_file_downloaded, which admits everything under transformer/ including a .bin twin, so the plan and the check cannot disagree about what has to be there. Where they part is a cache filled by from_pretrained rather than by this prefetch, and there the check is strict by a file the fetch would have taken anyway. That reads as not-cached, which declines the fast path and loads the GGUF, and costing speed on an unreadable or partial cache is the documented behaviour of this probe, not a defect in it. It also does not arise on the repos this is for, which ship safetensors only.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…r-rung retry

- An explicit Speed=off rewrites an auto request to 'off' and the plan stages no transformer/ on
  purpose, but the auto-decline block still ran and reported the deliberate bit-exact GGUF as a
  quant declined for want of shards, in the status payload and in the log. The block is gated on
  a scheme still being enabled.
- Auto's winner having no hosted pre-quant does not mean there is none to open: fp8 winning while
  only an int8 checkpoint is published is what the lower-rung retry exists for, and declining on
  the winner alone skipped past it to the GGUF for a checkpoint already on disk. The retry only
  ever returns a cached rung, so consulting it here costs nothing.
- The cache probe reads both roots. _prefetch_files resolves each file through whichever root
  holds it, so a snapshot left behind by a cache-folder change satisfies the pull without moving
  a byte, and reading the live root alone declined the fast path for a base entirely on disk.
# Conflicts:
#	studio/backend/tests/test_diffusion_backend.py
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
pre-commit-ci Bot and others added 4 commits August 9, 2026 15:41
# Conflicts:
#	studio/backend/core/inference/diffusion.py
#	studio/backend/tests/test_diffusion_backend.py
…oad request speak for itself

Counting the import-time root was wrong, and I had it backwards last round. _prefetch_files would
indeed not re-fetch from it, but the prefetch is not what this verdict unlocks: the dense fast
path calls from_pretrained pinned to hub_cache_dir(), cannot see the other root, and would
download the whole transformer again after eviction. That is the outcome the check exists to
prevent, so the probe reads the live root only.

And balanced, low_vram and the legacy cpu_offload flag name their policy outright, so the plan
omits transformer/ because the dense build is skipped rather than for want of cached bytes. The
auto-decline block skips those requests instead of reporting a second-denoiser refusal for them.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@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: b30bfc34d9

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

Comment on lines +2735 to +2737
elif (
not _transformer_prefetched
and not _dense_candidate_is_prequant(

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 Preserve the capacity-gate decline reason

When the dense transformer is fully cached but steady_total_mib exceeds the device budget, _dense_quant_prefetch_needed deliberately returns false at its capacity gate, so this branch interprets _transformer_prefetched=False as missing shards and reports that Auto refused a second download. No download was needed in this case—the quantized build simply cannot fit—and this early decline bypasses the later memory-fit logic that constructs the accurate resident-capacity reason. Carry the prefetch decision reason through or exclude capacity-gated requests before assigning the unstaged-shards explanation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not taking this one. The capacity gate and the unstaged-shards branch reach the same outcome -- the elif still requires _auto_prequant_retry_scheme to return None, so no cached lower rung is skipped, and the load ends on the GGUF either way. What differs is only the explanation string on an Auto: OFF badge, which is below the bar for a code change here.

danielhanchen and others added 2 commits August 9, 2026 19:22
…gate

_dense_transformer_cached judged prefer_ungated_mirror on the companions alone, but
_predownload_base hands it companions PLUS the transformer shards, and the upstream only wins
when its cache satisfies the whole set. Companions cached under a gated upstream beside a dense
transformer cached under the ungated mirror therefore kept the upstream, found no shards there
and declined the fast path for weights already on disk one repo over. Pass the same widened list
the fetch passes.

download_plan called _dense_quant_prefetch_needed eagerly, before the base listing exists, so
the cache probe inside it saw no transformer shards and always declined. The plan then scoped
narrower than the load it describes, the registry reported scope_file_mismatch and the plan
could not adopt the load's own in-flight job for the same base. Pass the callable _run_load
passes, so both paths derive the scope from the same listing.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The unsupported-device checks above the decline run for an EXPLICIT scheme only, so on CPU/MPS,
non-bf16 CUDA, a stubbed torchao runtime or a family this GPU rules out, an AUTO request reached
the new unstaged-shards branch and the badge told the user the base transformer/ shards were not
staged. True and irrelevant: caching them cannot enable a quant the host cannot run. The load is
unchanged either way (the dense re-plan is already gated on dense_transformer_supported), so this
is only about the reason, on the commonest path there is.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 2615c73305

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

return False
try:
transformer = Path(base).expanduser() / "transformer"
return transformer.is_dir() and any(transformer.glob("*.safetensors"))

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 Require all local transformer shards before enabling dense load

When a local GGUF base contains only one leftover shard from an interrupted dense-model copy, this any(...) check marks the entire transformer as staged. The auto path can then size only the shards that happen to exist and attempt from_pretrained on the incomplete dense transformer instead of declining immediately to the selected GGUF, potentially doing substantial CPU loading under an understated memory plan before failing back. A local base remains usable for a GGUF even when its unused transformer directory is partial, so verify the shard index/complete monolithic checkpoint rather than treating one safetensors file as completeness.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rejecting: this is hardening against a corrupted local directory, not a reachable defect. _local_base_transformer_present answers 'is this local base's transformer/ on disk', and the premise it states is that nothing can be downloaded from a directory, so a complete one is staged by definition. Getting a half-copied transformer/ there means an interrupted manual copy of a diffusers repo, which is not well-formed input, and the consequence is a loud from_pretrained error on the dense fallback rather than a wrong result or lost data (the memory plan comes from the family table, not the file list, so it is not understated either). A partial local base breaks a great deal more than this path, and index verification here would only move where it surfaces.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 2615c73305

ℹ️ 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 2b8ded2 into main Aug 10, 2026
41 of 45 checks passed
@danielhanchen
danielhanchen deleted the b8226 branch August 10, 2026 02:19
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.

1 participant