Skip to content

[Bug] Unsloth Studio / Desktop: Q4NX source picker lists every GGUF in the repo and calls a local Qwen3.5 Q4_0 "packs directly" - #18522

Merged
danielhanchen merged 6 commits into
unslothai:mainfrom
LeoBorcherding:studio/q4nx-picker-fit-first
Nov 23, 2026
Merged

danielhanchen merged 6 commits into
unslothai:mainfrom
LeoBorcherding:studio/q4nx-picker-fit-first

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The Q4NX source picker on the Export page lists every GGUF file a repo ships. For unsloth/Qwen3.5-4B-GGUF that is 22 files, and only one, Q4_K_M, packs as is; the other 21 are dequantized and rounded to 4-bit again, or refused, so the list buries the one file you want.

Separately, an On Device GGUF never has its architecture read before conversion, so a local Qwen3.5 Q4_0 is labeled "packs directly". That is the file #18064 refuses, because it answers with repeated slashes.

What changes

  • Each model lists the files that pack as is. The rest sit behind "N more files, re-quantized or not readable by this model". A file you already picked stays visible.
  • q4nxArchitecture falls back to the model name when the architecture is unknown, for the families whose layout isn't the Q4_1 default: Qwen3.5/3.6 (Q4_K), Qwen2.5 (Q4_0, not VL) and LFM2 (Q4_0). A local Qwen3.5 Q4_0 now reads "won't convert", Q4_K_M "packs directly".

Tests: export-q4nx-source.test.ts covers the name fallback and the short list. Frontend suite and typecheck pass.

Before / after on AMD DevLab gfx1151 (Radeon 8060S, XDNA2 NPU), Ubuntu 24.04, kernel 7.0.0-43, FastFlowLM 1.0.12 / Lemonade 2026.44.1, measured at 6eb70fd vs main 33c6179 (run 44425657543). Export > Convert to Q4NX, unsloth/Qwen3.5-4B-GGUF with Q4_K_M picked.

before (main) after (this branch)
before: all 22 GGUF files listed after: Q4_K_M listed, 21 more folded

Not run: the On Device path on a real local Qwen3.5 Q4_0 file; that half is covered by the unit test, not a screenshot.

Maintainer changes

  • Synced with main.
  • The name fallback reads only the last path segment, so a parent folder never names the family (an On Device /models/Qwen3.5-comparisons/Qwen2.5-3B-Instruct-Q4_0.gguf stays Qwen2.5 and packs directly).
  • The Qwen3.5 Omni override reads the same last segment, so /models/omni/Qwen3.5-4B-Q4_K_M.gguf is not treated as Omni.

Before / after at the current head

Export > Convert to Q4NX, unsloth/Qwen3.5-4B-GGUF, two isolated Studio installs built from the merge base and from this branch (f71fdf825). The NPU status is answered as ready in the browser so the tab renders; the file listing and packing tags are each build's own.

before (main): 22 files listed after: Q4_K_M, then "21 more files, re-quantized or not readable by this model"
before: all 22 GGUF files listed after: Q4_K_M listed, 21 more folded

Opening the fold lists the same 22 files as before.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Codex reviewed this branch on a mirror (LeoBorcherding/unsloth#978) at 6eb70fd, the current head: no findings.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Ci failure is unrelated to this pr:
image

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T05:10:05.198501Z 4b3955c 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e69bafc62e

ℹ️ 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 added a commit that referenced this pull request Nov 20, 2026
…18657)

## Summary

`Frontend unit tests` fail on `main` (seen on #18522, reproduced on
current `main`):

```
not ok - the backend refuses an image generate while a load is in flight
  location: studio/frontend/tests/images-generate-during-switch.test.ts:77
  The input did not match the regular expression /if await asyncio\.to_thread\(_image_load_in_flight\):\s*raise HTTPException\(\s*status_code = 409/
```

## Cause

#18420 added this source check: a generate that arrives while a model
load is in flight was refused straight away with 409. Then #18626
deliberately changed that branch in `routes/inference.py`:

- a generate during a load whose pipeline is already published now waits
out the load's tail (encoder pins);
- a generate that cannot wait (pipeline not published yet, or the tail
outlasts the cap) is still refused with the in-flight 409.

#18626 covered the new behaviour with backend tests
(`test_images_generate_load_tail.py`), but this frontend check still
expected the 409 on the line right after the `if`. The product change is
right; the check is out of date.

## Change

`images-generate-during-switch.test.ts` now asserts the invariant both
PRs share, that no image run starts while a load is in flight. It finds
the in-flight branch before a run is admitted and requires both:

- that it waits out the tail (`await _wait_image_load_tail(`);
- that it still raises `HTTPException(status_code = 409, detail =
IMAGE_LOAD_IN_FLIGHT_MSG)` when it cannot.

## Testing

- On `main` the file fails 1 of 7. With this change: 7 passed.
- Sabotage on `routes/inference.py`, each of which fails the new check:
  - removing the in-flight 409;
  - replacing the tail wait.
@danielhanchen danielhanchen self-assigned this Nov 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member

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

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

export function q4nxArchitecture(architecture?: string | null, name?: string | null): string | null {
const arch = architecture?.trim().toLowerCase();
if (arch) return arch;
return NAME_ARCHITECTURES.find(([re]) => re.test(name ?? ""))?.[1] ?? null;

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 unrelated ancestors from architecture inference

When a local GGUF is selected by an absolute path, name is selectedRow.id, so it includes every ancestor directory. For example, /models/Qwen3.5-comparisons/Qwen2.5-3B-Instruct-Q4_0.gguf matches the Qwen3.5 rule in the parent directory instead of the file's Qwen2.5 family. Consequently, q4nxPacking now returns mismatch and the export summary says Convertible: No for a valid Qwen2.5 Q4_0 source; the parent commit reports it as direct. Infer the family from the actual model/file identity or trusted metadata rather than allowing unrelated path components to override it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in c026309: the name fallback now reads only the last path segment, so a parent folder never names the family; added the Qwen2.5-under-a-Qwen3.5-folder case to the test.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

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

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

/** The quant that packs directly for an architecture, or null when it is not known. */
export function q4nxFitQuant(architecture?: string | null, name?: string | null): string | null {
const arch = architecture?.trim().toLowerCase();
const arch = q4nxArchitecture(architecture, name);

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 Normalize the model name for the Omni override too

For an On Device source such as /models/omni/Qwen3.5-4B-Q4_K_M.gguf, the new fallback infers qwen35, but q4nxFitQuant then checks the entire path for omni. A normal Qwen3.5 model consequently reports mismatch and Convertible: No, and the settings recommend Q4_1, which the backend rejects for that model. Unlike the fixed family-name regex, this separate Omni override still searches ancestor directories; apply the same basename normalization to that decision.

Useful? React with 👍 / 👎.

@danielhanchen danielhanchen Nov 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in 4b3955c: the Omni override now reads the same last path segment as the family fallback; added the /models/omni/ Qwen3.5 case and a real Omni name to the test.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 4b3955c5a0

ℹ️ 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 Nov 23, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 23, 2026
@danielhanchen
danielhanchen merged commit 8643359 into unslothai:main Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants