Skip to content

Commit 9a7ddda

Browse files
authored
Follow AutoRound updates [2.x] (#1652)
Signed-off-by: Kaihui-intel <[email protected]>
1 parent cf1de74 commit 9a7ddda

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

.azure-pipelines/scripts/ut/env_setup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ elif [[ $(echo "${test_case}" | grep -c "tf pruning") != 0 ]]; then
9999
fi
100100

101101
if [[ $(echo "${test_case}" | grep -c "api") != 0 ]] || [[ $(echo "${test_case}" | grep -c "adaptor") != 0 ]]; then
102-
pip install git+https://github.com/intel/auto-round.git@6815f8b66be456ecbef2d0beb33dbc4efeefdc04
102+
pip install git+https://github.com/intel/auto-round.git@d02f94d4b085523df3b313863fb07f83b2989cce
103103
fi
104104

105105
# test deps

neural_compressor/adaptor/pytorch.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4913,11 +4913,11 @@ def autoround_quantize(self, model, tune_cfg, dataloader):
49134913
weight_config[op_name]["data_type"] = config["weight"]["dtype"]
49144914
weight_config[op_name]["bits"] = config["weight"]["bits"]
49154915
weight_config[op_name]["group_size"] = config["weight"]["group_size"]
4916-
weight_config[op_name]["scheme"] = config["weight"]["scheme"]
4916+
weight_config[op_name]["sym"] = config["weight"]["scheme"] == "sym"
49174917

49184918
# auto round recipes
49194919
enable_full_range = self.recipes["autoround_args"].get("enable_full_range", False)
4920-
bs = self.recipes["autoround_args"].get("bs", 8)
4920+
batch_size = self.recipes["autoround_args"].get("batch_size", 8)
49214921
lr_scheduler = self.recipes["autoround_args"].get("lr_scheduler", None)
49224922
dataset_name = self.recipes["autoround_args"].get("dataset_name", "NeelNanda/pile-10k")
49234923
dataset_split = self.recipes["autoround_args"].get("dataset_split", "train")
@@ -4943,10 +4943,10 @@ def autoround_quantize(self, model, tune_cfg, dataloader):
49434943
tokenizer=None,
49444944
bits=4,
49454945
group_size=128,
4946-
scheme="asym",
4946+
sym=False,
49474947
weight_config=weight_config,
49484948
enable_full_range=enable_full_range,
4949-
bs=bs,
4949+
batch_size=batch_size,
49504950
lr_scheduler=lr_scheduler,
49514951
dataloader=dataloader,
49524952
dataset_name=dataset_name,

neural_compressor/adaptor/torch_utils/weight_only.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,10 @@ def autoround_quantize(
677677
tokenizer,
678678
bits: int = 4,
679679
group_size: int = 128,
680-
scheme: str = "asym",
680+
sym: bool = False,
681681
weight_config: dict = {},
682682
enable_full_range: bool = False, ##for symmetric, TODO support later
683-
bs: int = 8,
683+
batch_size: int = 8,
684684
amp: bool = True,
685685
device=None,
686686
lr_scheduler=None,
@@ -711,7 +711,7 @@ def autoround_quantize(
711711
tokenizer: Tokenizer for processing input data. Temporarily set as a mandatory parameter.
712712
bits (int): Number of bits for quantization (default is 4).
713713
group_size (int): Size of the quantization group (default is 128).
714-
scheme (str): The quantization scheme to be used (default is "asym").
714+
sym (bool): Whether the symmetric quantization is to be used.
715715
weight_config (dict): Configuration for weight quantization (default is an empty dictionary).
716716
weight_config={
717717
'layer1':##layer_name
@@ -758,10 +758,10 @@ def autoround_quantize(
758758
tokenizer=tokenizer,
759759
bits=bits,
760760
group_size=group_size,
761-
scheme=scheme,
761+
sym=sym,
762762
weight_config=weight_config,
763763
enable_full_range=enable_full_range, ##for symmetric, TODO support later
764-
bs=bs,
764+
batch_size=batch_size,
765765
amp=amp,
766766
device=device,
767767
lr_scheduler=lr_scheduler,

neural_compressor/model/torch_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ def export_compressed_model(
559559
new_module.pack(int_weight, gptq_scale, gptq_zp, m.bias, gptq_perm)
560560
set_module(self.model, k, new_module)
561561
elif autoround_config:
562-
from auto_round.export.export_to_itrex.export import _pack_model # pylint: disable=E0401
562+
from auto_round.export.export_to_itrex.export import pack_model # pylint: disable=E0401
563563

564-
self.model = _pack_model(
564+
self.model = pack_model(
565565
self.model,
566566
weight_config=autoround_config,
567567
enable_full_range=enable_full_range,

test/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--find-links https://download.pytorch.org/whl/torch_stable.html
22
accelerate==0.21.0
33
dynast==1.6.0rc1
4-
git+https://github.com/intel/auto-round.git@6815f8b66be456ecbef2d0beb33dbc4efeefdc04
4+
git+https://github.com/intel/auto-round.git@d02f94d4b085523df3b313863fb07f83b2989cce
55
horovod
66
intel-extension-for-pytorch
77
intel-tensorflow>=2.12.0

0 commit comments

Comments
 (0)