Enable static quantization for Qwen3-0.6B decoder (transformer-only)#836
Draft
spalne wants to merge 2 commits into
Draft
Enable static quantization for Qwen3-0.6B decoder (transformer-only)#836spalne wants to merge 2 commits into
spalne wants to merge 2 commits into
Conversation
Comment on lines
+157
to
+163
| from .qwen3_modeling import ( | ||
| WinMLQwen3Attention, | ||
| WinMLQwen3DecoderLayer, | ||
| WinMLQwen3MLP, | ||
| WinMLQwen3Model, | ||
| WinMLQwen3RMSNorm, | ||
| ) |
Comment on lines
+33
to
+37
| from .qwen3_export_ops import ( | ||
| GroupQueryAttentionOnnxExport, | ||
| LpNormOnnxExport, | ||
| TransposeConv2d1x1Transpose, | ||
| ) |
|
|
||
| COMPOSITE_MODEL_REGISTRY[("qwen3", "text-generation")] = WinMLQwen3TransformerOnlyModel | ||
|
|
||
| _INSTALLED = True |
|
@spalne please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a transformer-only ONNX export path for Qwen3 that emits a fused (GQA) GroupQueryAttention op (with built-in rotary), LpNormalization RMSNorm, and 1×1 Conv projections, backed by an FP16 KV cache. The path is opt-in via install(), which hot-patches the build registries to produce two graphs (prefill seq=64, decode seq=1) without embeddings or lm_head. Quantization runs w8a16 static PTQ on these graphs using GSM8K calibration
Results
Produces two transformer-only ONNX files (prefill + decode) plus their w8a16-quantized variants.