Skip to content

Commit

Permalink
update int4 usage
Browse files Browse the repository at this point in the history
Signed-off-by: Kaihui-intel <[email protected]>
  • Loading branch information
Kaihui-intel committed Jul 22, 2024
1 parent 967b780 commit e538a63
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions neural_compressor/torch/quantization/algorithm_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,14 @@ def autoround_quantize_entry(
if quant_config.name != AUTOROUND or quant_config.dtype == "fp32":
continue
else:
dtype = quant_config.dtype
bits = quant_config.bits
if dtype != "int" and "int" in dtype:

This comment has been minimized.

Copy link
@WeiweiZhang1

WeiweiZhang1 Jul 23, 2024

Contributor

if dtype.count("int") > 0 and dtype.index("int") == 0:
dtype = "int"
bits = quant_config.bits

How about this way, we can ensure that only match strings that begin with "int", except in cases of mixed precision situations like "mxfp_int".

bits = int(dtype.lstrip("int"))
dtype = "int"
weight_config[op_name] = {
"data_type": quant_config.dtype,
"bits": quant_config.bits,
"data_type": dtype,
"bits": bits,
"sym": quant_config.use_sym,
"group_size": quant_config.group_size,
"act_bits": quant_config.act_bits,
Expand Down

0 comments on commit e538a63

Please sign in to comment.