Skip to content

Fix GGUF variant file selection#6342

Merged
wasimysaid merged 10 commits into
unslothai:mainfrom
wasimysaid:fix/gguf-variant-resolution
Jun 16, 2026
Merged

Fix GGUF variant file selection#6342
wasimysaid merged 10 commits into
unslothai:mainfrom
wasimysaid:fix/gguf-variant-resolution

Conversation

@wasimysaid

Copy link
Copy Markdown
Collaborator

Summary

Fix GGUF variant resolution so a request for stories260K picks the matching little endian file.
Skip big endian GGUF files during automatic chat model selection.
Add regression coverage for the tinyllamas cache shape that failed Studio UI CI.

Test plan

Python compile for changed backend files.
Ruff check for changed backend files.
Backend GGUF fallback tests passed.
Backend cached GGUF route tests passed.
Frontend typecheck passed.
Diff whitespace check passed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors GGUF variant file resolution in the backend to prefer exact quant-label matches over loose substring matches, preventing incorrect resolution (such as matching big-endian variants). It also updates the frontend to filter out big-endian GGUF files during the auto-load process. The review feedback suggests enhancing runtime safety by wrapping the backend's quant-label extraction in a try-except block and adding defensive null/undefined checks for the variant filename in the frontend.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread studio/backend/core/inference/llama_cpp.py
Comment thread studio/frontend/src/features/chat/api/chat-adapter.ts Outdated
@wasimysaid

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a helper function _gguf_files_for_variant in the backend to resolve GGUF files matching a requested variant, preferring exact quant-label matches, and adds corresponding tests. In the frontend, it prevents auto-loading big-endian GGUF files by introducing a helper function isAutoLoadableGgufVariant with a regular expression check. The review feedback suggests improving this regular expression to also support underscores as separators (e.g., _be), ensuring more robust detection of big-endian variants.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread studio/frontend/src/features/chat/api/chat-adapter.ts Outdated

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

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

Comment thread studio/frontend/src/features/chat/api/chat-adapter.ts
Comment thread studio/backend/core/inference/llama_cpp.py
Comment thread studio/backend/core/inference/llama_cpp.py

@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: 896da65d1f

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

Comment thread studio/backend/utils/models/model_config.py

@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: 97e39ab82b

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

Comment thread studio/backend/utils/models/model_config.py
Comment thread studio/backend/core/inference/llama_cpp.py Outdated
Comment thread studio/backend/routes/models.py
Comment thread studio/backend/utils/models/model_config.py
@wasimysaid

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 1711c61d66

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

@wasimysaid wasimysaid merged commit 048f34e into unslothai:main Jun 16, 2026
31 of 33 checks passed
jecruz added a commit to jecruz/unsloth that referenced this pull request Jun 16, 2026
jecruz added a commit to jecruz/unsloth that referenced this pull request Jun 17, 2026
jecruz added a commit to jecruz/unsloth that referenced this pull request Jun 25, 2026
The TestGgufVariantFileResolution class exercises upstream's
_is_big_endian_gguf_path filter (PR unslothai#6342, commit 6b1a736)
which was deliberately reverted in our fork via 3bb9cf8
('Revert "Fix GGUF variant file selection (unslothai#6342)"').

Marking strict xfail so:
- CI does not flag these as regressions after the upstream merge
- Tests still run and report xfail (not silently skipped)
- Rationale and revert commit are documented inline for future revisit

If the revert rationale is reconsidered and the filter is re-applied,
remove this xfail marker to re-enable the tests.
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.

2 participants