Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
89fcb80
update
wenhuach21 Jul 10, 2026
7fd8e31
refine calibration
wenhuach21 Jul 10, 2026
9879bdf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 10, 2026
dda7019
update
wenhuach21 Jul 10, 2026
c3b8d65
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 10, 2026
a434d30
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 10, 2026
9de04c7
update
wenhuach21 Jul 10, 2026
59fc3e1
delete calibrated compressor
wenhuach21 Jul 10, 2026
1f00668
Merge branch 'main' into refine_calib
wenhuach21 Jul 10, 2026
f3a39c0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 10, 2026
03d54f8
update
wenhuach21 Jul 10, 2026
ffece56
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 10, 2026
b52c7ba
update
wenhuach21 Jul 10, 2026
d5df818
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 10, 2026
a85831e
update
wenhuach21 Jul 13, 2026
fbde68c
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 13, 2026
e2a1a2a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
13dba59
fix
wenhuach21 Jul 13, 2026
f902622
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 13, 2026
6370a91
fix
wenhuach21 Jul 13, 2026
854bdba
fix
wenhuach21 Jul 13, 2026
cd8e38d
fix
wenhuach21 Jul 13, 2026
84eda88
fix
wenhuach21 Jul 13, 2026
5d41cf4
Merge branch 'main' into refine_calib
wenhuach21 Jul 13, 2026
d0227e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
21655c6
trigger ut
wenhuach21 Jul 13, 2026
4e03283
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
6f5f61c
fix mllm ut
wenhuach21 Jul 13, 2026
98a0511
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 13, 2026
b0e0f54
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
136729e
fix ut
wenhuach21 Jul 13, 2026
3c1f9d5
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 13, 2026
02c1436
Merge branch 'main' into refine_calib
wenhuach21 Jul 13, 2026
fba33de
fix some ut issues
wenhuach21 Jul 13, 2026
8134744
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
ee7f5a0
fix some uts
wenhuach21 Jul 13, 2026
0744571
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 13, 2026
db5ea9d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2026
ac3f5ad
fix one issue
wenhuach21 Jul 14, 2026
3a4d354
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 14, 2026
12af12d
try to fix ut
wenhuach21 Jul 14, 2026
1d05a82
update
wenhuach21 Jul 14, 2026
5c45b57
fix
wenhuach21 Jul 14, 2026
d0cd22b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
66d663c
update
wenhuach21 Jul 14, 2026
6add45f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
01d1b42
update
wenhuach21 Jul 14, 2026
ef073fc
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 14, 2026
9d6dec2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
001e4d3
adjust
wenhuach21 Jul 14, 2026
ad79ee5
update
wenhuach21 Jul 14, 2026
4486175
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
aa5d2f0
update
wenhuach21 Jul 14, 2026
6c9efd8
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 14, 2026
4237f49
update
wenhuach21 Jul 14, 2026
ebcfee7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
03b68da
try to fix some uts
wenhuach21 Jul 14, 2026
8fa6f5d
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 14, 2026
229124b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
3dfe627
update
wenhuach21 Jul 14, 2026
c04181b
add comments
wenhuach21 Jul 14, 2026
eac9d90
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 14, 2026
f06557b
Merge branch 'main' into refine_calib
wenhuach21 Jul 14, 2026
1b2ff27
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2026
a3ce2ec
try to fix uts
wenhuach21 Jul 15, 2026
6140268
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 15, 2026
7764862
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
87e37e8
fix
wenhuach21 Jul 15, 2026
da688b9
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 15, 2026
64bbbaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
83c7dad
update
wenhuach21 Jul 15, 2026
1e92dfb
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 15, 2026
8f2b7be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
2ea2773
update
wenhuach21 Jul 15, 2026
6d7c4f1
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 15, 2026
4f1fdaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
cb14e05
fix gguf vram issue
wenhuach21 Jul 15, 2026
2fc5b6d
Merge branch 'refine_calib' of https://github.com/intel/auto-round in…
wenhuach21 Jul 15, 2026
e994c95
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 25 additions & 44 deletions auto_round/algorithms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,20 @@
# limitations under the License.


from contextlib import contextmanager
from typing import Any

from auto_round.algorithms.registry import resolve_pipeline_member
from auto_round.schemes import QuantizationScheme


class BaseAlgorithm:
pass


class BasePipelineMember:
"""Shared interface for all members of a quantization pipeline."""

model_context = None
compress_context = None
_scheme_context_fields = set(QuantizationScheme.get_attributes())
bits: int | None
group_size: int | tuple | None
sym: bool | None
data_type: str | None
act_bits: int | None
act_group_size: int | None
act_sym: bool | None
act_data_type: str | None
act_dynamic: bool | None
super_bits: int | None
super_group_size: int | None
super_sym: bool | None
scale_dtype: str | None

def __init__(self, config: Any = None) -> None:
self.config = config
self.config = config # TODO wenhuach may be deleted
self.scheme = getattr(config, "scheme", None)

@classmethod
Expand All @@ -58,6 +39,7 @@ def from_config(cls, config: Any) -> "BasePipelineMember":

def bind(self, compressor: Any) -> None:
"""Wire shared context from the owning compressor."""
self.compressor = compressor
self.model_context = compressor.model_context
self.compress_context = compressor.compress_context
self.scheme = getattr(compressor, "scheme_context", None)
Expand All @@ -66,35 +48,34 @@ def prepare_run(self, compressor: Any) -> None:
"""Model-level preparation called once before block iteration starts."""
return

def get_act_calib_policy(self, ctx: Any) -> Any:
"""Return the activation calibration policy for this block."""
from auto_round.algorithms.pipeline import ActCalibPolicy, CalibTiming, InputSource
def register_fp_input_forward_hooks(self, block: Any) -> list:
"""Register hooks for the FP-input reference forward pass.
return ActCalibPolicy(when=CalibTiming.SKIP, source=InputSource.FP_CACHE)
Subclasses override to collect statistics during the reference forward.
Returns a list of hook handles; caller must call h.remove() on each.
@contextmanager
def block_forward_hooks(self, ctx: Any) -> Any:
"""Register algorithm-specific forward hooks for the reference forward."""
yield []
Default: no-op (empty list).
"""
return []

def finalize_run(self, compressor: Any) -> None:
"""Model-level teardown called once after all blocks are processed."""
return


def _make_scheme_property(name):
def getter(self):
scheme = getattr(self, "scheme", None)
return getattr(scheme, name, None) if scheme is not None else None

def setter(self, value):
scheme = getattr(self, "scheme", None)
if scheme is None:
raise AttributeError(f"{type(self).__name__} has no bound scheme")
setattr(scheme, name, value)

return property(getter, setter)


for _scheme_field in QuantizationScheme.get_attributes():
setattr(BasePipelineMember, _scheme_field, _make_scheme_property(_scheme_field))
# def _make_scheme_property(name):
# def getter(self):
# scheme = getattr(self, "scheme", None)
# return getattr(scheme, name, None) if scheme is not None else None
#
# def setter(self, value):
# scheme = getattr(self, "scheme", None)
# if scheme is None:
# raise AttributeError(f"{type(self).__name__} has no bound scheme")
# setattr(scheme, name, value)
#
# return property(getter, setter)
#
#
# for _scheme_field in QuantizationScheme.get_attributes():
# setattr(BasePipelineMember, _scheme_field, _make_scheme_property(_scheme_field))
Loading
Loading