-
Notifications
You must be signed in to change notification settings - Fork 350
[1/N] Polish deployment skills - Add a debug loop for unsupported models #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Edwardf0t1
wants to merge
1
commit into
main
Choose a base branch
from
zhiyu/polish-deployment-skills
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
.claude/skills/deployment/references/unsupported-models.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Deploying Unsupported Models | ||
|
|
||
| When deploying a model not in the validated support matrix (`references/support-matrix.md`), expect failures. This guide covers the iterative debug loop for getting unsupported models running on vLLM, SGLang, or TRT-LLM. | ||
|
|
||
| ## Step 1 — Run and collect the error | ||
|
|
||
| Submit the deployment job. When it fails, read the full log — focus on the **first** error traceback (not "See root cause above" wrappers). Identify the file and line number in the framework source. | ||
|
|
||
| ## Step 2 — Diagnose the root cause | ||
|
|
||
| Fetch the framework source at the failing line (use `gh api` for the tagged version, or `find` inside the container). Common error categories: | ||
|
|
||
| | Category | Symptoms | Examples | | ||
| |----------|----------|----------| | ||
| | **Weight key mismatch** | `KeyError`, `Unexpected key`, `Missing key` during weight loading | Checkpoint uses `model.language_model.layers.*` but framework expects `model.layers.*`. See [vllm#39406](https://github.com/vllm-project/vllm/pull/39406) | | ||
| | **Quantized/unquantized layer confusion** | Wrong layer type loaded, dtype errors, shape mismatches | Framework tries to load unquantized layers with FP4 kernel due to overly broad `quantization_config.ignore` patterns or missing ignore entries. See [sglang#18937](https://github.com/sgl-project/sglang/pull/18937) | | ||
| | **Missing architecture support** | `NoneType is not iterable`, `KeyError` on model type, unknown architecture | Framework's model handler doesn't recognize the text backbone type (e.g., `ministral3` not handled in vLLM's `mistral3.py` init). Fix: extend the model type mapping | | ||
| | **Transformers version mismatch** | `ImportError`, `KeyError` on config fields | Framework ships with older transformers that doesn't know the model type. Fix: upgrade transformers after installing the framework | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix grammar in the transformers mismatch guidance. The sentence uses incorrect subject-verb agreement: “transformers that doesn’t know”. Update to “transformers that don’t know”. 🤖 Prompt for AI Agents |
||
| | **Kernel-level issues** | CUDA errors, `triton` import failures, unsupported ops | Framework lacks kernel support for this model + quantization combo | | ||
|
|
||
| ## Step 3 — Apply a targeted fix | ||
|
|
||
| Focus on **small, targeted patches** to the framework source. Do not modify `config.json` or the checkpoint — fix the framework's handling instead. | ||
|
|
||
| ### Weight key mismatches and architecture mapping gaps | ||
|
|
||
| Patch the framework source in the run script using `sed` or a Python one-liner. Keep patches minimal — change only what's needed to unblock the current error. | ||
|
|
||
| ```bash | ||
| # Example: extend model type mapping in vLLM mistral3.py | ||
| FRAMEWORK_FILE=$(find /usr/local/lib -path "*/vllm/model_executor/models/mistral3.py" 2>/dev/null | head -1) | ||
| sed -i 's/old_pattern/new_pattern/' "${FRAMEWORK_FILE}" | ||
| ``` | ||
|
|
||
| > **Tip**: when locating framework source files inside containers, use `find` instead of Python import — some frameworks print log messages to stdout during import that can corrupt captured paths. | ||
| ### Quantized/unquantized layer confusion | ||
|
|
||
| Check `hf_quant_config.json` ignore patterns against the framework's weight loading logic. The framework may try to load layers listed in `ignore` with quantized kernels, or vice versa. Fix by adjusting the framework's layer filtering logic. | ||
|
|
||
| ### Kernel-level issues | ||
|
|
||
| These require framework kernel team involvement. Do NOT attempt to patch kernels. Instead: | ||
|
|
||
| 1. Document the exact error (model, format, framework version, GPU type) | ||
| 2. Inform the user: *"This model + quantization combination requires kernel support that isn't available in {framework} v{version}. I'd suggest reaching out to the {framework} kernel team or trying a different framework."* | ||
| 3. Suggest trying an alternative framework (vLLM → SGLang → TRT-LLM) | ||
|
|
||
| ## Step 4 — Re-run and iterate | ||
|
|
||
| After applying a fix, resubmit the job. Each iteration may reveal a new error (e.g., fixing the init error exposes a weight loading error). Continue the loop: **run → read error → diagnose → patch → re-run**. | ||
|
|
||
| Typical iteration count: 1-3 for straightforward fixes, 3-5 for models requiring multiple patches. | ||
|
|
||
| ## Step 5 — Know when to stop | ||
|
|
||
| **Stop patching and escalate** when: | ||
|
|
||
| - The error is in compiled CUDA kernels or triton ops (not Python-level) | ||
| - The fix requires changes to core framework abstractions (not just model handlers) | ||
| - You've done 5+ iterations without the server starting | ||
|
|
||
| In these cases, inform the user and suggest: trying a different framework, checking for a newer framework version, or filing an issue with the framework team. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this reference doc, the path
references/support-matrix.mdis relative to the current file, which already lives underreferences/. On GitHub this will resolve toreferences/references/support-matrix.md(broken link). Use a relative link to the sibling file instead (e.g.,support-matrix.md).