Repository navigation
Studio: resolve GET /v1/models/<id>:<quant> for an on-disk quant - #12727
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7043f6e3e6
ℹ️ 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".
| resident = listed.get("quant") or getattr(get_llama_cpp_backend(), "hf_variant", None) | ||
| if listed.get("loaded") and str(resident or "").lower() == variant.lower(): |
There was a problem hiding this comment.
Use the matching slot when inferring the resident quant
When the resolver index is cold and a model is resident in an extra slot, its catalog row can omit quant, but this fallback executes after _openai_model_objects() has left that slot's routing context, so get_llama_cpp_backend() returns the primary backend. If the slots use different quants, retrieving the extra slot's resident pin is reported as unloaded; if its requested quant happens to match the primary quant, it is incorrectly reported as loaded with the extra model's context fields. Preserve the originating slot/quant while building the row or otherwise query the backend associated with listed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 69cf31f: residency now comes from the slot whose backend serves the listed id, not the primary backend.
| base, sep, quant = model_id.rpartition(":") | ||
| # ":latest" names no quant, so the resolver would answer it with the repo's default one. | ||
| if not sep or not base or not looks_like_quant(quant): |
There was a problem hiding this comment.
Resolve accepted legacy pins before rejecting suffixes
For GGUFs whose previously published variant label is not quant-shaped, such as the legacy Meta-Llama-3-8B.gguf label 8B, resolve_local_gguf() deliberately accepts <id>:8B through _legacy_variant_aliases() so cached client pins continue working. This early looks_like_quant() check rejects that request before consulting the resolver, so GET /v1/models/<id>:8B still returns 404 even though chat completions accept the identical model string. Distinguish an exact legacy-alias resolution from generic non-quant fallbacks such as :latest rather than rejecting all non-quant-shaped suffixes up front.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 69cf31f: the suffix is resolved against current labels and legacy aliases, so :8B style pins resolve while :latest still 404s.
| shared = { | ||
| k: listed[k] for k in ("object", "created", "owned_by", "display_name") if k in listed | ||
| } |
There was a problem hiding this comment.
Preserve the task on alternate quant objects
When a loaded GGUF is a speech model, its catalog row carries task: "text-to-speech", but retrieving another on-disk quant takes this branch and copies only the four whitelisted fields, silently dropping task. The resulting model object presents the alternate quant as an untyped model even though the base and resident-quant objects identify it as TTS; clients that interpret a missing task as a chat model can consequently route the validated pin to the wrong API. Preserve variant-independent capability fields such as task while omitting only resident-specific context fields.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 69cf31f: task is kept on alternate quant objects; only resident context fields are dropped.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Part of #9340.
Problem
POST /v1/chat/completionsaccepts"model": "<repo>:<quant>"to pin one of several downloaded quants, butGET /v1/models/<repo>:<quant>returned 404 for the same string. A client that validates a model id before using it was told the model does not exist.Change
GET /v1/models/{id}now falls back, after the existing exact-id and legacy-path matches, to resolving<listed id>:<quant>:/v1/modelslisting, so models hidden from a managed account stay hidden;:q8_0->:Q8_0);:latest) or a quant that is not downloaded still 404s;loaded: true, context fields); any other quant returnsloaded: falsewithout the resident model's context fields.GET /v1/models(the list) is unchanged.Verification
Real resolver and catalog scan against an isolated HF cache holding
unsloth/SmolLM2-135M-Instruct-GGUFQ8_0 + Q4_K_M:GET /v1/models/unsloth/SmolLM2-135M-Instruct-GGUF:Q4_K_M{"id": "...:Q4_K_M", "quant": "Q4_K_M", "loaded": false}GET /v1/models/unsloth/SmolLM2-135M-Instruct-GGUF:q8_0{"id": "...:Q8_0", "quant": "Q8_0", "loaded": false}GET /v1/models/unsloth/SmolLM2-135M-Instruct-GGUF:Q2_K(not downloaded)GET /v1/models/unsloth/SmolLM2-135M-Instruct-GGUF:latestGET /v1/models/unsloth/SmolLM2-135M-Instruct-GGUFquant: Q4_K_MLive Studio on a GPU (this branch, llama-server serving SmolLM2 Q8_0 with Q4_K_M also on disk):
GET /v1/models/...GGUF:Q8_0(resident)200 {"quant": "Q8_0", "loaded": true, "context_length": 2048}GET /v1/models/...GGUF:q4_k_m200 {"id": "...:Q4_K_M", "quant": "Q4_K_M", "loaded": false}GET /v1/models/...GGUF:Q2_K/:latest404 model_not_foundGET /v1/models/...GGUFquant: Q8_0,loaded: true)The first request after a load arrives before the resolver index is rewarmed, when the loaded row carries no
quantyet; the resident check falls back to the backend's loaded variant so the resident pin still reportsloaded: true.Tests: four new cases in
tests/test_openai_catalog.py; the positive ones fail on main and pass here, the 404 case guards against over-matching. Failing test IDs acrosstest_openai_catalog.py,test_openai_auto_switch.py,test_keyless_api_access_adversarial.py,test_warm_window_review_fixes.pyandtest_account_local_model_resolver.pyare identical on main and this branch (environment only:fastmcpnot installed, host HF cache rows).Not covered here: listing each quant as its own id in
GET /v1/models, which is what dropdown-only clients in #9340 need.