Skip to content

Studio: stop a multi-checkpoint GGUF repo collapsing into one row per quant - #8222

Merged
danielhanchen merged 33 commits into
mainfrom
ggufrows
Aug 10, 2026
Merged

danielhanchen merged 33 commits into
mainfrom
ggufrows

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The bug

unsloth/LTX-2.3-GGUF holds 63 GGUFs across three distinct checkpoints that share quant labels:

<root>/          22 files   ltx-2.3-22b-dev-*.gguf
distilled/       22 files   ltx-2.3-22b-distilled-*.gguf
distilled-1.1/   19 files   ltx-2.3-22b-distilled-1.1-*.gguf

The picker keyed each row on the quant token alone and summed every file sharing it, so the repo collapsed to 22 rows, every one of them resolving into distilled-1.1/. The dev checkpoint could not be selected at all, and each row advertised the total of all three copies:

Q6_K   53.32 GB advertised   <- three separate 17.77 GB files

That size is not cosmetic. It feeds the download planner, the cache-readiness check (a fully downloaded quant never reads as complete, because the plan expects three files and a load only ever writes one) and the VRAM guard in routes/inference.py.

Scanning all 361 unsloth/*GGUF* repos found four more affected, in a milder shape: the same quant published twice.

repo quant advertised actual
Llama-3.3-70B-Instruct-GGUF Q6_K 115.78 GB 57.89 GB
DeepSeek-R1-Distill-Llama-70B-GGUF Q6_K 115.78 GB 57.89 GB
QwQ-32B-GGUF BF16 131.07 GB 65.54 GB

The fix

Two independent halves, both pure functions of the snapshot-relative path.

1. gguf_variant_key() decides a row's identity. It stays the bare quant token whenever that token names the file within its path, which is the shape every repo but one uses, so the persisted key is byte-identical there. A directory that names something other than a quant (distilled/) marks a separate checkpoint, and the key becomes the file's shard family instead (distilled/ltx-2.3-22b-distilled-Q6_K). A quant-named directory adds nothing the basename already says, and the basename still decides which quant a file is, so Q8_0/model-Q4_K_M.gguf is still the Q4_K_M file.

Purity is the point. The remote listing sees a whole repo while a cache scan sees whatever was downloaded; a key that depended on the file set would disagree between them and strand a finished download as incomplete.

2. A row describes one shard family. Summing is right across the shards of one split GGUF and wrong across two copies of one quant, so the row and the download plan take the family holding the lexicographically first file, which is the shard the lister advertises and the loader opens.

The quant string is the persisted variant identity, so everything that keys on it moved in lockstep: the plan matcher is_main_gguf_variant_path, build_gguf_variant_plans, the readiness scan _completed_gguf_variants, variant deletion, cached-path resolution, and the three resolvers that turn a chosen row back into a file (model_config._find_local_gguf_by_variant, llama_cpp._gguf_files_for_variant, picker.service). Those three previously took the first match by name, which handed a request for the repo-root Q6_K the alphabetically earlier distilled/ copy. model_config carries a mirror of the key function because utils cannot import hub; a test asserts the two agree.

Rows whose key had to be qualified carry a display_label (Q6_K · distilled), and the /gguf-variants route now forwards it instead of dropping it.

Result

unsloth/LTX-2.3-GGUF, before and after, against the live Hub:

before   22 rows   Q6_K  53.32 GB   distilled-1.1/ltx-2.3-22b-distilled-1.1-Q6_K.gguf

after    63 rows   Q6_K                   17.77 GB   ltx-2.3-22b-dev-Q6_K.gguf
                   Q6_K · distilled       17.77 GB   distilled/ltx-2.3-22b-distilled-Q6_K.gguf
                   Q6_K · distilled-1.1   17.77 GB   distilled-1.1/ltx-2.3-22b-distilled-1.1-Q6_K.gguf

All three checkpoints are selectable, and each resolves to its own weights.

Across all 361 unsloth/*GGUF* repos, 356 are byte-identical before and after, in row count, row filename and row size. Five change, and only where they were wrong: LTX-2.3 (22 to 63 rows), and the three duplicate-copy repos above (row counts unchanged, sizes halved to the truth).

Shard collapse, which is why the summing exists, is preserved: 152 repos ship genuinely split GGUFs and every one is unchanged. unsloth/DeepSeek-R1-0528-GGUF still lists BF16 as a single 1342.27 GB row spanning 30 shards. unsloth/Wan2.2-TI2V-5B-GGUF still lists 13 rows.

Backwards compatibility

For the 356 unaffected repos nothing moves: the key string is unchanged, so pins, download manifests, cancel markers and transport markers all keep resolving, and the manifest filename fragment is still the readable q4_k_m rather than a hash.

For LTX-2.3 the keys do change, and that repo's stored state was describing the wrong file anyway. Nothing is re-downloaded: readiness is recomputed from disk with the same function that builds the rows, so an already-downloaded distilled-1.1/...-Q6_K.gguf still reads as complete under its new key. A pin stored as the bare Q6_K still resolves, now to the repo-root dev checkpoint, which is one real file instead of a row that silently meant distilled-1.1/ at three times its size. A manifest left under the old key is orphaned rather than harmful; the row is complete by disk scan regardless.

Tests

studio/backend/tests/test_gguf_variant_rows.py, 34 cases covering the key, the rows, the plan, readiness, deletion, all three resolvers, subset stability and Windows separators. Every assertion was mutation-tested: 14 mutations, each breaking one thing the fix guards (keying on the quant token again, ignoring the parent directory, summing across families, dropping the family narrowing in the plan, drifting the loader mirror, and so on). All 14 were killed, no survivors, and the suite is green after restoring.

studio/backend/hub/tests/: 304 passed, unchanged from the merge base.

studio/backend/tests/: the FAILED/ERROR line set is unchanged from the merge base apart from test_local_llama_cpp_link.py::test_orphan_cleanup_kills_under_real_root, a process-cleanup timing test that passes 3 out of 3 in isolation and touches nothing here.

Known residue

unsloth/Qwen3.5-35B-A3B-Experiments-GGUF still collapses 5 quants into one row each: two experiment configs differ only in where a quant token sits inside a config string (exp-16-iq2_s-16 against exp-iq2_s-16-16), same directory, same trailing shape. Telling those apart needs a basename-level key, which would change the persisted variant string for every repo, so it is deliberately out of scope here.

danielhanchen and others added 6 commits August 9, 2026 06:30
…token

A repo holding several checkpoints at the same quant labels collapsed into one
row per quant. unsloth/LTX-2.3-GGUF ships 63 GGUFs across three checkpoints
(repo root, distilled/, distilled-1.1/); the picker showed 22 rows, every one
of them resolving into distilled-1.1/, so the dev checkpoint could not be
selected at all, and each row advertised the sum of all three copies.

Rows are now keyed on gguf_variant_key(), which stays the bare quant token when
that token names the file within its path (the shape almost every repo uses, so
the persisted key is unchanged there) and falls back to the file's shard family
otherwise. A row also describes one shard family rather than every file sharing
a key, so a repo that ships the same quant twice no longer advertises double.
The loader, llama.cpp file selection and the picker's chat-template lookup all
resolved a variant by quant label and took the first match by name, so in a repo
holding several checkpoints at one quant a request for the repo-root Q6_K row
opened distilled/'s copy instead. Each now prefers the files whose own variant
key is the requested one, via a mirror of gguf_variant_key in model_config
(utils cannot import hub).
…heckpoint repos

The gguf-variants route rebuilt each row and dropped display_label, so a
path-qualified variant would have read as its whole relative path. Variant
deletion matched on the basename, which for a repo holding several checkpoints
at one quant deleted all of them for a single row.
_resolve_quant_gguf and _resolve_cached_model_path compared only the quant
label, so a path-qualified variant found nothing in the cache and a load or an
export fell back to a repo-wide walk.
A quant-named directory says nothing the basename does not already say, and the
basename still decides which quant a file is (Q8_0/model-Q4_K_M.gguf IS the
Q4_K_M file), so only a directory naming something else marks a separate
checkpoint. Also stop qualifying on a quant token that is not at the end of the
name: <model>-<QUANT>-MTP is an established spelling.

@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

required_hashes = frozenset(file.sha256 for file in expected if file.sha256)
main_size = sum(max(0, int(file.size or 0)) for file in main_files)
download_size = sum(max(0, int(file.size or 0)) for file in expected)

P1 Badge Restrict download metadata to the chosen shard family

When a variant key covers two copies of the same quant, _one_shard_family narrows only main_files, while expected still contains both families. Consequently these lines calculate required_hashes and download_size_bytes from both copies, and the target_filenames and manifest built immediately below also retain both; hf_download.py passes those targets directly to snapshot_download. The affected repos therefore still download and account for both copies despite advertising only the chosen family's size.

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

if is_mmproj_filename(name) or is_mtp_drafter_path(name):
continue
quant = extract_quant_label(name).lower()
quant = gguf_variant_key(name).lower()

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 Scope vision projectors to each checkpoint plan

When non-quant directories contain separate vision checkpoints with their own mmproj files, this new key creates a plan per checkpoint, but build_gguf_variant_plans still selects one repo-wide preferred mmproj above and folds it into every plan. Downloading any row therefore fetches the same projector regardless of checkpoint; loading can either reject it as a family mismatch and silently lose vision support or accept an incompatible same-family projector and produce incorrect vision results. The companion selection must follow the selected checkpoint's path scope rather than remain global.

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 one. The projector is repo-wide at LOAD too: llama_cpp._pick_mmproj takes the cached mmproj files for the repo, sorted, preferring the -f16 one, with no path scoping at all. So a per-checkpoint download plan would fetch a projector the loader never opens, which is the plan-versus-load disagreement the rest of this PR exists to remove. The repo-wide selection predates this change and is unaltered by it; scoping it means changing preferred_mmproj_sibling, _pick_mmproj and the manifest's repo-wide mmproj_filenames together, which is a separate change and not one this PR should smuggle in.

The qualified label was assembled and passed, then dropped. routes/models.py
builds models.models.GgufVariantDetail, but only its hub.schemas.inventory twin
declared display_label, so pydantic discarded the kwarg without a word and every
qualified row reached the picker labelled with its whole relative path instead
of "Q6_K . distilled".

Found by looking at the picker in a browser; no unit test could see it, because
both halves were individually correct.
@danielhanchen

Copy link
Copy Markdown
Member Author

Correcting my own PR body: the claim that the route "now forwards display_label instead of dropping it" was not true when I wrote it.

routes/models.py builds models.models.GgufVariantDetail, but only its twin in hub/schemas/inventory.py declared the field. Pydantic discarded the kwarg without a word, so none of the 63 rows carried a label and the picker rendered qualified rows as their whole relative path (distilled/ltx-2.3-22b-distilled-Q6_K) rather than Q6_K · distilled.

Cosmetic rather than a correctness problem, and the row counts, sizes and file resolution in this PR were all correct, but the assertion was wrong. Fixed in 871a088b5: the field is declared on the model the route actually builds, with two tests that fail when it is removed.

No unit test could have caught this, because both halves were individually correct. It only shows up by looking at the picker, which is also where the substance of the PR was confirmed: 63 rows, three separate Q6_K entries at 17,774,906,400 bytes each, against 22 collapsed rows at 53.32 GB before.

@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: 871a088b52

ℹ️ 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 +310 to +312
parents = path.rpartition("/")[0]
if any(segment and not _is_quant_directory(segment) for segment in parents.split("/")):
return _unknown_gguf_variant_key(path)

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 Migrate legacy bare-quant download state

On upgrade, an interrupted download created before this commit for a path such as distilled/model-Q6_K.gguf is persisted under the old Q6_K variant key, while this branch now lists and plans it only as distilled/model-Q6_K. _with_state_partials exposes the legacy Q6_K row because it no longer matches a listed key, but the worker's build_gguf_variant_plans(...).get("q6_k") returns no plan and deletion also matches only the new qualified key, so that row can neither resume nor delete its partial files. Add legacy-key migration or alias resolution when introducing the qualified key.

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 rows this touches are exactly the ones whose old key was wrong: a bare Q6_K that stood for several checkpoints at once, which is the bug being fixed, so there is no correct state to carry forward. Nothing is lost either, because the partial bytes live in the huggingface_hub blob store keyed per file and etag, not under our variant key, so restarting the download under the qualified key resumes the same .incomplete blobs rather than re-fetching them. What is left is a stale row in the in-flight state of a download that was already interrupted, against alias migration threaded through the plan builder, the deletion path and the job registry. Not a trade worth making.

Comment on lines +349 to +352
for path, size in entries:
families.setdefault(gguf_variant_key(path), {}).setdefault(
gguf_variant_family(path), []
).append((path, int(size or 0)))

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 Avoid distinct rows for case-equivalent variant keys

When two checkpoint scopes differ only by case, such as Dev/model-Q6_K.gguf and dev/model-Q6_K.gguf in a case-sensitive Hub repo, this case-sensitive grouping emits two qualified rows. The plan builder, requirement maps, loader, deletion code, and job registry all lowercase variant keys, however, so selecting either row resolves the same combined key and ultimately the same lexicographically chosen family; one advertised row therefore loads or downloads the other checkpoint. Either deduplicate keys case-insensitively before advertising rows or preserve case sensitivity throughout variant resolution.

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. Two directories in one repo differing only in case is not a shape any real repo ships, and the remedy has a real cost either way: case-insensitive dedup silently drops an advertised checkpoint, and making resolution case-sensitive end to end would break every stored pin, manifest and marker that was written lowercased. Not worth it for a repo layout nobody publishes.

danielhanchen and others added 3 commits August 9, 2026 12:03
Three ways a row still reached outside itself:

- The plan narrowed only main_files to one shard family. target_filenames, required_hashes and
  download_size_bytes still held the discarded copy, so the worker fetched both, reclaim deleted
  the unchosen one as not-ours, and the finished job reported partial and fetched it again.
- looks_like_quant full-matches a quant token, which no slash-qualified key can satisfy, so an
  absent qualified checkpoint fell through to the first local variant and answered under the
  requested model id.
- The bare quant label names every checkpoint carrying that quant, so the repo-root row matched
  the qualified files too and took whichever sorted first. Exact keys now rank above the legacy
  label spelling, which stays as the fallback for rows that have no qualified one.

Also: two checkpoints in ONE directory shared a display label, which is two rows a user cannot
tell apart, so a colliding scope shows the file as well.
@danielhanchen

Copy link
Copy Markdown
Member Author

Screenshots of what this changes, from two isolated Studio installs: one built at this PR's merge base, one at its head. Same flow driven against both, unsloth/LTX-2.3-GGUF in the Model hub quant picker, resolved against the live Hub.

before and after

The listing endpoint agrees with the picture: 22 rows before, 63 after.

rows BF16 Q8_0
before 22 126 GB 68 GB
after 63 42 GB, three times 23 GB, three times

126 is 3 x 42 and 68 is 3 x 23, which is the summing this fixes: one row per quant token, holding the total of all three checkpoints, every one of them resolving into distilled-1.1/. After, each checkpoint is its own row at its own size, and the bare BF16 row is the repo-root dev checkpoint, which could not be selected at all before.

One consequence worth calling out because it is visible above and is not a bug: the default selection moves from BF16 to Q4_K_M - distilled-1.1, since the default resolver now chooses among real checkpoints rather than among collapsed rows.

Both installs were built with install.sh --local so each carries its own frontend bundle, and the before side is the merge base rather than current main, so nothing that landed in between is being credited here.

@danielhanchen

Copy link
Copy Markdown
Member Author

Checked what this does to repos that do NOT have the collapsing problem, comparing full row identity (key, label, size, filename) between a merge-base build and this branch against the live Hub, rather than just row counts. A count-only check would miss a key rename, and the key is what gets persisted as a pinned quant.

repo layout rows result
unsloth/gemma-3-4b-it-GGUF flat, one file per quant 26 to 26 identical
unsloth/Qwen3-8B-GGUF flat, one file per quant 25 to 25 identical
unsloth/Llama-3.2-3B-Instruct-GGUF flat, one file per quant 27 to 27 identical
unsloth/DeepSeek-R1-0528-GGUF sharded, many files per quant 27 to 27 identical
unsloth/DeepSeek-V3.1-GGUF quant-named subdirectories 27 to 27 identical

The last two are the ones worth stating. A sharded repo must still sum across the shards of one quant, and a quant-named directory like UD-Q8_K_XL/ is exactly what a naive version of this change would misread as a separate checkpoint. Neither moves.

On the milder affected repos the key set is unchanged and only the size is corrected, so pins survive untouched: Llama-3.3-70B-Instruct-GGUF Q6_K keeps its key and its file, 107.83 GiB to 53.91 GiB.

One migration consequence that is not in the description above, and is worth recording. For unsloth/LTX-2.3-GGUF no key is removed, so a pin does not break, but the surviving bare keys now resolve to a different file:

key before after
BF16 distilled-1.1/ltx-2.3-22b-distilled-1.1-BF16.gguf ltx-2.3-22b-dev-BF16.gguf
Q8_0 distilled-1.1/ltx-2.3-22b-distilled-1.1-Q8_0.gguf ltx-2.3-22b-dev-Q8_0.gguf

That is the intended reading, since a bare quant token should name the repo-root checkpoint, but it means anyone who had pinned a quant in this one repo silently moves from the distilled-1.1 checkpoint to dev. If they already had the distilled-1.1 file on disk it is not lost, it just appears under its own new row, while the pinned row now reads as not downloaded and fetches the dev file. This affects this repo only.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

The picker builds its rows from the hub copy, but three consumers take their variant identities
from utils/models/model_config and openai_auto_download instead: the /v1 local index, the remote
VRAM preflight, and the auto-download size map. All three still grouped on the bare quant label,
so a qualified row was invisible to them, and since a slash-qualified suffix is now read as an
explicit variant that miss is a 404 rather than a fallback onto another checkpoint.

They key on the variant key now. The endian test still takes the quant token, which is what it
reads, and a repo whose quant token already names its file lists exactly what it listed before,
so no stored pin and no /v1 model id changes.

@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: 96a3020072

ℹ️ 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 +310 to +312
parents = path.rpartition("/")[0]
if any(segment and not _is_quant_directory(segment) for segment in parents.split("/")):
return _unknown_gguf_variant_key(path)

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 Distinguish checkpoint-named quant directories

When separate checkpoints are stored under directories that themselves contain a quant token—for example dev-Q6_K/weights-Q6_K.gguf and distilled-Q6_K/weights-Q6_K.gguf—every parent passes _is_quant_directory, so both files still receive the bare Q6_K key. group_gguf_variant_files then treats their distinct families as duplicate copies and advertises only the lexicographically first one, recreating the hidden-checkpoint regression this change is meant to fix; only genuinely redundant quant directories should be ignored when constructing the key.

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 the trade rather than the reading. A directory whose own name carries the quant is treated as redundant on purpose, and the case that rule exists for is the common unsloth layout where the directory repeats the model name and the quant (Llama-3.3-70B-Instruct-Q6_K/ beside Q6_K/). The only discriminator available is whether the segment says anything besides the quant, and that same test reclassifies every one of those directories as a distinct checkpoint, re-keying repos that are working today and resetting every pin that holds them. dev-Q6_K/ beside distilled-Q6_K/ is a layout I have not seen published, and paying that price for it is the wrong way round. The bare-quant fallback added for the container case does not help here either, and deliberately so: with two checkpoints at one quant the bare name names neither.

Keying the listers on the variant key outright also renamed rows with no recognised quant token,
whose label here has always been the last hyphenated segment rather than the whole stem
(Qwen3.6-27B-MTP-001-of-002.gguf listed as MTP). That difference is old and has nothing to do with
several checkpoints sharing a quant, and renaming those rows breaks the pins that hold them for no
gain. The key is used only where a recognised token is qualified by a non-quant directory.
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
@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.

@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

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

ℹ️ 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 210 to +214
<span className="min-w-0 flex-1 truncate font-mono">
{variant.quant}
{/* The key is the selection identity and can be path-qualified
("distilled/ltx-2.3-22b-distilled-Q6_K"); the label is what it reads as.
onSelect and the recommended check still key on variant.quant. */}
{ggufVariantDisplayLabel(variant)}

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 friendly label in the recipe selector trigger

For a path-qualified GGUF variant, this list row shows the new friendly display_label, but after selection SelectorTrigger renders the raw ggufVariant in both its normal and compact presentations (lines 290–301). The selector therefore replaces Q6_K · distilled with a long internal path as soon as the popover closes; carry the selected variant's display label into the trigger while retaining variant.quant as the selection value.

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.

Same finding, but declining this one on cost. SelectorTrigger is handed only the ggufVariant STRING -- the variant objects are fetched inside LocalModelRow, three components down -- so closing it means either plumbing the label up through three components or deriving it from the key with a quant vocabulary duplicated in TypeScript, which is the sort of thing that silently drifts from the backend the next time a quant type is added. The row the user chooses from reads correctly, and the trigger shows the stored key, which is unattractive but unambiguous. Not worth either cost here; happy to revisit if the trigger grows access to the variant list for another reason.

The list rows read as "Q6_K . distilled" but the trigger still printed the raw selectedVariant,
so the label vanished the moment the popover closed -- which is where the choice is actually
read. The variants are already in scope there; the value bound to the Select is unchanged.
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 927f6308b5

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

…ontract at the key

Source lint's import-hoist safety net blocks on the import deletion.py no longer uses (the bare
alias goes through bare_quant_alias now).

tests/studio pinned the literal extract_quant_label(gguf_files[0].name) in common.py, which the
variant-key switch re-pointed. For a standalone .gguf there is no directory to qualify, so the
key IS the quant token -- and it keeps the bpw modifier, which is what makes it agree with the
loader's own _extract_quant_label, the equality the sibling contract test depends on. The hub
label drops that modifier, so the key is the more correct target here, not merely the new one.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 9, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

… remote default

The quant-directory layout carries the modifier upstairs (IQ4_XS-3.53bpw/model.gguf), which is
exactly where extract_quant_token looks next, so reading only the basename gave both builds the
bare IQ4_XS key: grouping and the plan kept one family, and deleting that advertised key unlinked
both. The suffix now comes from whichever segment named the quant, and the walk stops there so a
modifier further up the tree is not claimed.

pick_best_gguf keeps whichever filename it met first among equals, so a repo with model-Q6_K.gguf
beside distilled/model-Q6_K.gguf could hand the picker the distilled checkpoint as its automatic
default -- while a bare repo id means the ROOT checkpoint to _match_variant(None, ...) and to
local_model_resolver. Prefer root rows when there are any, as those two already do.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

The red Unsloth Tauri CI / Rust unit tests (windows) on this PR is a flake, not this branch. Recording it so nobody spends time on it.

thread 'desktop_backend_owner::tests::stale_blank_observer_cannot_delete_a_competing_callers_id'
panicked at src\desktop_backend_owner.rs:1671:51:
called `Result::unwrap()` on an `Err` value: "could not read the desktop ownership id at
C:\Users\RUNNER~1\AppData\Local\Temp\unsloth-root-id-stale-blank-observer-...\share\studio_install_id:
Access is denied. (os error 5)"

Two reasons it is not attributable here. This PR touches deletion.py, api.ts and pickers.tsx and no Rust at all, and the same branch has run this workflow ten times with one failure and six successes, the failure being the current head:

failure  3adc15d4     <- this run
success  30e98ba1
success  927f6308
success  5a24ebfc
success  460363cf
success  dc580d35
success  a46b1b34

os error 5 reading a file the test itself just created in %TEMP% is the Windows shape of a lost race, usually a handle still open or an antivirus or indexer touching the path between create and read, so it is worth a look as a test-hardening item in its own right rather than as a blocker here.

The other red checks on this PR are the two test_diffusion_training.py cases main is currently red on, fixed by #8281, and Backend CI jobs cancelled by a timeout-minutes: 15 the suite has outgrown, raised in #8286.

…d the delete's alias

/gguf-variants answers from three branches (remote, cached, partial-local) and only the remote
one preferred root rows, so the automatic default depended on which branch served the request --
and in the offline and prefer_local_cache flows a bare repo id could select the distilled
checkpoint while _match_variant(None, ...) and local_model_resolver both mean the root. One
helper, all three.

Deletion accepts an unambiguous bare quant for a path-qualified key, but the load-state guard
still compared the two spellings literally, so a model loaded through a legacy bare pin could be
deleted through its advertised qualified row without the 'Unload the model before deleting'
refusal -- unlinking the resident model's snapshot and blob. The guard is alias-aware now, and
deliberately loose: a false match only refuses a delete, a false miss loses weights.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 10, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 10, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 10, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 10, 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: 335a85494d

ℹ️ 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 thread studio/backend/routes/models.py Outdated
Comment on lines +3375 to +3377
chosen = ranked[0] or ranked[1]
matches = [(rel, f) for rel, f, _size in chosen]
total = sum(size for _rel, _f, size in chosen)

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 Restrict estimates to the selected shard family

When a snapshot contains duplicate families sharing one variant key, such as QwQ-32B's two BF16 shard sets, every file lands in ranked[0]; this then sums both families even though the new lister, download plan, and loader select only the lexicographically first family. Consequently /kv-cache-estimate reports roughly double the actual weights_bytes, producing a false exceeds-memory warning and potentially preferring a snapshot merely because it contains redundant copies. Group chosen by the same shard-family rule used by group_gguf_variant_files before selecting the path and total.

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.

Confirmed and fixed in 0c3647e. _resolve_quant_gguf now narrows the chosen rank to the one shard family the loader opens, the same rule group_gguf_variant_files applies, so QwQ-32B's two BF16 shard sets no longer double weights_bytes into a false exceeds-memory warning or make a snapshot look more complete for holding a redundant copy. Test covers the duplicated pair and a genuinely split GGUF surviving whole.

Comment on lines +137 to +139
variant_key = (
variant.lower() if "/" in variant else (extract_quant_token(variant) or variant).lower()
)

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 Prune the parent directory of qualified variants

When the final cached variant has a qualified key such as weights/model-Q4_K_M, the key includes both the directory and the shard-stripped filename, but this cleanup only inspects immediate subdirectories and compares their single name against the whole key. After the GGUF is unlinked, the empty weights/ directory therefore remains, which in turn prevents _remove_empty_snapshot_dirs from removing the now-empty revision and leaves a stale cache snapshot after the user deleted the last variant. Derive and prune the actual parent directory from the matched snapshot paths rather than treating the qualified key itself as a folder name.

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 one. What is left behind is an EMPTY directory: no weights, no bytes, no wrong load, and the delete itself did remove the file. The wart is real (an empty revision dir the inventory can still count), but the durable fix is a bottom-up prune of empty directories under the snapshot rather than another name-match against a variant key -- name-matching a directory is exactly what stopped working when keys became path-qualified, so repeating it here just moves the next break. Out of scope for this PR.

Comment on lines 3673 to 3674
variant_filenames = [v.filename for v in variants]
best = _pick_best_gguf(variant_filenames)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict remote auto-selection to root checkpoint rows

When a multi-checkpoint repo is loaded without an explicit variant through ModelConfig.from_identifier, this ranks every qualified checkpoint together. For LTX-style listings, a distilled/...-Q6_K filename can occur before the root ...-Q6_K filename, so _pick_best_gguf silently chooses the distilled checkpoint even though the local resolver and OpenAI auto-download path introduced by this change explicitly define a bare repo ID as the root checkpoint. The same bare model ID therefore serves different weights depending on the load path; filter to variants whose key is unqualified whenever such rows exist before picking the best quant.

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.

Correct, and this was the one that mattered most -- the LOAD path itself, the fourth resolver of a bare repo id. Fixed in 0c3647e: from_identifier now ranks root rows when any exist, filtered on the same _qualified_variant_name identity the lister assigns each row, so local_model_resolver, the auto-download map, /gguf-variants and this all answer a bare id with the root checkpoint.

…e on one shard family

ModelConfig.from_identifier is the LOAD path and was the fourth resolver of a bare repo id:
_pick_best_gguf keeps whichever filename it met first among equals, so an LTX-style listing that
puts distilled/...-Q6_K before the root ...-Q6_K made a bare id load the distilled checkpoint,
while local_model_resolver, the auto-download map and /gguf-variants all mean the root.

_resolve_quant_gguf summed every file that matched the key, so a snapshot holding the same quant
twice (QwQ-32B's two BF16 shard sets) reported double the weights the loader opens --
/kv-cache-estimate turns that into a false exceeds-memory warning, and it can make a snapshot
look more complete purely for holding a redundant copy. Narrow to the one shard family the loader
reads, the same rule group_gguf_variant_files applies; a genuinely split GGUF is one family and
survives whole.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 0c3647eb89

ℹ️ 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 9959212 into main Aug 10, 2026
54 of 58 checks passed
@danielhanchen
danielhanchen deleted the ggufrows branch August 10, 2026 02:21
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