add other non-integer scheme support for awq#1892
Conversation
Signed-off-by: n1ck-guo <heng.guo@intel.com>
for more information, see https://pre-commit.ci
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Signed-off-by: Xin He <xin3.he@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Liang Lv <liang1.lv@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
…-round into hengguo/refactor_algs
…-round into hengguo/refactor_algs
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…#1698) Signed-off-by: lvliang-intel <liang1.lv@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: lkk12014402 <kakao.lv@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: chensuyue <suyue.chen@intel.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: n1ck-guo <heng.guo@intel.com>
Signed-off-by: yiliu30 <yi4.liu@intel.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…ent in tests (#1857) Signed-off-by: Xin He <xin3.he@intel.com>
There was a problem hiding this comment.
Pull request overview
This PR updates AutoRound’s AWQ pipeline so AWQ’s internal “reference QDQ” path can track the downstream block-quantizer scheme for non-integer data types (e.g., MXFP/NVFP), addressing the linked request for AWQ smoothing compatibility beyond INT schemes. It also expands AWQ with optional post-smoothing weight clipping and refactors AWQ naming to clarify it is a transform/preprocessor.
Changes:
- Introduces
QDQToolas a reusable, scheme-aware quantize-dequantize utility and composes it intoAWQTransformfor loss evaluation and optimized init-scale dispatch. - Adds AWQ clip options (
apply_clip,clip_as_init, and related search knobs) and propagates clip values via model context / wrapper initialization paths. - Renames/aliases
AWQQuantizer→AWQTransformthroughout the pipeline/registry and extends tests for V2 detection/init-scale dispatch (plus new clip tests).
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
auto_round/algorithms/quantization/qdq_tool.py |
New centralized QDQ primitive for scheme-aware loss evaluation. |
auto_round/algorithms/transforms/awq/base.py |
AWQ refactor to AWQTransform, integrates QDQTool, adds smooth_iters + optional clip search/apply. |
auto_round/algorithms/transforms/awq/config.py |
Adds AWQ clip/smooth iteration config and scheme-finalization hook. |
auto_round/algorithms/transforms/awq/__init__.py |
Exposes AWQTransform and keeps AWQQuantizer as a deprecated alias. |
auto_round/algorithms/transforms/__init__.py |
Updates lazy exports for AWQ transform/alias. |
auto_round/algorithms/registry.py |
Updates registration import path for AWQ pipeline member. |
auto_round/algorithms/pipeline.py |
Updates docstring references from AWQQuantizer to AWQTransform. |
auto_round/compressors/base.py |
Adds finalize_scheme() hook invocation for alg configs after scheme resolution. |
auto_round/context/model.py |
Adds awq_clip_values storage on model context for downstream quantizers. |
auto_round/wrapper.py |
Uses AWQ clip-as-init values to cap SignRound tunable min/max range. |
auto_round/algorithms/quantization/sign_roundv2/quantizer.py |
Refactors optimized init-scale path to use shared utils; adds AWQ clip-as-init integration for V2. |
auto_round/data_type/utils.py |
Adds shared optimized init-scale / quant-func dispatch helpers and imatrix reshaping utility. |
auto_round/data_type/int.py |
Makes quant_tensor_sym tolerant of scalar max_scale when reusing init_scale in one-shot QDQ. |
auto_round/cli/algorithms.py |
Adds CLI flags for AWQ clipping/clip-as-init. |
auto_round/eval/evaluation.py |
Passes device into lm-eval HF model wrappers and prepares torch.nn.Module models for eval device/dtype. |
test/test_cpu/algorithms/test_awq.py |
Adds CPU tests for AWQ clip behavior and V2 scale-search detection/dispatch. |
test/test_cuda/algorithms/test_awq.py |
Adds CUDA unit tests for V2 detection + init-scale dispatch helper behavior. |
test/test_cpu/core/test_pipeline_fail_fast.py |
Updates pipeline expectation to AWQTransform. |
test/test_cpu/core/test_hpu_clear_memory.py |
Adds unit test for ClearMemory’s HPU path using mocking. |
AGENTS.md |
Deleted (agent guidance removed). |
.gitignore |
Adds .codegraph/ ignore entry. |
Comments suppressed due to low confidence (5)
auto_round/algorithms/transforms/awq/base.py:505
_normalize_group_size()assumesgroup_sizeis anintand doesgroup_size > 0. If a tuple group size is ever passed (supported elsewhere viareshape_pad_tensor_by_group_size(..., group_size=(M,N))), this will raiseTypeError. Either explicitly reject tuple group sizes for AWQ, or treat them as “no 1-D grouping” and fall back.
auto_round/algorithms/transforms/awq/base.py:547prepare_layer_funcs()can raise (e.g., if the layer’s resolved scheme has no registered quant func). Previously AWQ would typically skip/penalize that mapping; now this will abort the entire AWQ run. Consider catching resolution failures here and skipping smoothing for that mapping instead of crashing the quantization run.
auto_round/algorithms/transforms/awq/base.py:789- The clip search step count does not actually reach
clip_max_shrinkas documented. Withclip_max_shrink=0.5, clip_n_grid=20,n_steps=int(0.5*20)=10and the loop only reaches1 - 9/20 = 0.55(55%), not 50%. Adjust the step calculation / loop bounds so the search includes the intended shrink limit.
auto_round/algorithms/transforms/awq/base.py:821 _apply_clip()rebindslayer.weight.datato a new tensor. Usingcopy_avoids replacing the underlying storage/metadata and is safer with optimizers / hooks (even though this runs underno_grad).
auto_round/algorithms/transforms/awq/base.py:749- Docstring says the clip search returns a
[out_channels, n_group]tensor, but the implementation returnsbest_max_val.squeeze(1)which is[out_channels, n_group, 1](as also noted in the inline comment). Please align the docstring with the actual shape to avoid confusion for downstream callers.
Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com>
for more information, see https://pre-commit.ci
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com>
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
n1ck-guo
left a comment
There was a problem hiding this comment.
LGTM.
There have been some design and architectural modifications, and I will work with Weiwei to make some improvements later.
Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com>
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: WeiweiZhang1 <weiwei1.zhang@intel.com>
|
/azp run Unit-Test-CUDA-AutoRound |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Please briefly describe your main changes, the motivation.
Type of Change
Exprimental Feature and Bugfix
docs and example will be updated in the next PR
Related Issues
Fixes or relates to #
Checklist Before Submitting
/azp run Unit-Test-CUDA-AutoRound.#1834