Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion auto_round/compressors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@ def get_act_max_hook(module, input, output):
config = self.layer_config[n]
act_dynamic = config.get("act_dynamic", True)
act_data_type = config.get("act_data_type", None)
act_bits = config.get("act_data_type", 16)
act_bits = config.get("act_bits", 16)
if (
config["bits"] <= 8
and check_need_act_calibration(act_dynamic, act_data_type, act_bits)
Expand Down
16 changes: 16 additions & 0 deletions test/test_cpu/test_autoround.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ def test_bits_setting(self):
if module.bits != 8:
raise ValueError(f"Expected bits to be 8, but got {module.bits}")

def test_layer_config(self):
model_name = "/tf_dataset/auto_round/models/facebook/opt-125m"
layer_config = {"self_attn": {"bits": 4, "data_type": "nv_fp", "act_bits": 16, "group_size": 16}}
autoround = AutoRound(
model_name,
self.tokenizer,
scheme="NVFP4",
iters=0,
seqlen=2,
dataset=self.llm_dataloader,
layer_config=layer_config,
amp=False,
)
autoround.quantize_and_save(self.save_folder, inplace=False, format="fake")
shutil.rmtree(self.save_folder)

def test_remove_whole_block(self):
model_name = "/tf_dataset/auto_round/models/facebook/opt-125m"
layer_config = {
Expand Down