Skip to content

refine transform config api.#1607

Merged
chensuyue merged 28 commits intointel:mainfrom
lkk12014402:refine_transform_api
Mar 26, 2026
Merged

refine transform config api.#1607
chensuyue merged 28 commits intointel:mainfrom
lkk12014402:refine_transform_api

Conversation

@lkk12014402
Copy link
Contributor

@lkk12014402 lkk12014402 commented Mar 24, 2026

#1577

Description

refine transform config api, which supports str|dict|TransformConfig|None

Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
Copilot AI review requested due to automatic review settings March 24, 2026 15:16
@lkk12014402
Copy link
Contributor Author

TODO: add document

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refines the transform config API so callers can pass a str | dict | TransformConfig | None, and normalizes inputs before applying transforms.

Changes:

  • Added a shared normalization helper to validate/standardize transform config inputs.
  • Updated apply_transform to accept multiple config input types plus an optional quantization scheme.
  • Updated compressor initialization to accept and normalize transform_config directly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
auto_round/experimental/transform/helper.py Adds _normalize_transform_config for validating and converting transform_config inputs into a normalized dict.
auto_round/experimental/transform/apply.py Expands apply_transform signature and normalizes user inputs before building TransformConfig.
auto_round/compressors/base.py Adds transform_config parameter and normalizes it during compressor initialization.

lkk12014402 and others added 9 commits March 25, 2026 10:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
@chensuyue chensuyue added this to the 0.12.0 milestone Mar 25, 2026
@wenhuach21
Copy link
Contributor

wenhuach21 commented Mar 25, 2026

As also mentioned before, these two args in transform_config should not be exposed to users.

  location: str = Field(default="weight", exclude=True)

  # apply transform inside modules for nvfp4, autoround tuning etc.
  need_calibration: bool = Field(default=False, exclude=True)

@wenhuach21
Copy link
Contributor

wenhuach21 commented Mar 25, 2026

and this one

 # required, currently only supports mxfp4
    quant_scheme: str = Field(..., description="Quantization scheme. Currently supports 'MXFP4/MXFP8'.")

why users need to pass the scheme once again?

@wenhuach21 wenhuach21 requested a review from n1ck-guo March 25, 2026 08:32
@lkk12014402
Copy link
Contributor Author

lkk12014402 commented Mar 25, 2026

and this one

 # required, currently only supports mxfp4
    quant_scheme: str = Field(..., description="Quantization scheme. Currently supports 'MXFP4/MXFP8'.")

why users need to pass the scheme once again?

need check the supported quantization scheme with transform

@lkk12014402
Copy link
Contributor Author

As also mentioned before, these two args in transform_config should not be exposed to users.

  location: str = Field(default="weight", exclude=True)

  # apply transform inside modules for nvfp4, autoround tuning etc.
  need_calibration: bool = Field(default=False, exclude=True)

the arg location determines where the Hadamard transform is applied, like weight or activation, we need set the parameter when need transform activation

the arg need_calibration is for calibration (like nvfp4) and tuning (iters > 200)

@wenhuach21
Copy link
Contributor

For API design, please take a position of uers, not developer

and this one

 # required, currently only supports mxfp4
    quant_scheme: str = Field(..., description="Quantization scheme. Currently supports 'MXFP4/MXFP8'.")

why users need to pass the scheme once again?

need check the supported quantization scheme with transform

I know, this is not the right logic. you should check it in another place

lkk12014402 and others added 4 commits March 25, 2026 11:58
Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
@wenhuach21
Copy link
Contributor

@chensuyue @XuehaoSun To support Hadamard, a safetensor file has been added to the main branch. I assume we will not include this file in the release package by default. Please help include it if Kaokao thinks it is a better option than generating it at runtime.

@wenhuach21 wenhuach21 self-requested a review March 26, 2026 02:07
lkk12014402 and others added 7 commits March 26, 2026 02:54
Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
Signed-off-by: lkk12014402 <kaokao.lv@intel.com>
@xin3he
Copy link
Contributor

xin3he commented Mar 26, 2026

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chensuyue
Copy link
Contributor

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@chensuyue
Copy link
Contributor

@chensuyue @XuehaoSun To support Hadamard, a safetensor file has been added to the main branch. I assume we will not include this file in the release package by default. Please help include it if Kaokao thinks it is a better option than generating it at runtime.

Added into release package.

@chensuyue chensuyue merged commit f07048b into intel:main Mar 26, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants