Enable static quantization for Qwen3-0.6B decoder (transformer-only)#836
Draft
spalne wants to merge 1 commit into
Draft
Enable static quantization for Qwen3-0.6B decoder (transformer-only)#836spalne wants to merge 1 commit into
spalne wants to merge 1 commit into
Conversation
| import logging | ||
| from pathlib import Path | ||
|
|
||
| import onnx |
|
@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.
Introduces a post-training quantization pipeline for the Qwen3-0.6B decoder in winml-cli. The flow runs after the standard composite build: ad-hoc ONNX surgery strips the embedding Gather and lm_head MatMul from both decoder_prefill and decoder_gen, exposing inputs_embeds as the graph input and output_hidden_states as the graph output. The resulting transformer-only graphs are then statically quantized to w8a16 (uint8 weights, uint16 activations, QDQ format, per-tensor, MinMax calibration) using a PyTorch-backed calibration reader that runs HF embed_tokens over real chat-templated prompts to produce realistic inputs_embeds, attention masks, position IDs, and zero-initialized KV cache feeds.
To run -
set QUANTIZE=1
python "test_qwen 2.py"