Skip to content

Commit 8b93850

Browse files
authored
Fix is_asymmetric parsing in get_quant_embedding_transform (pytorch#21997)
Differential Revision: D116868435 Pull Request resolved: pytorch#21997
1 parent 89e6f90 commit 8b93850

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎examples/models/llama/source_transformation/quantize.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,14 @@ def get_quant_embedding_transform(
791791
is_asymmetric = True
792792
else:
793793
bitwidth, group_size, is_asymmetric = quant_args
794+
# bool("false") is True, so the third field has to be parsed as text.
795+
is_asymmetric = is_asymmetric.strip().lower() not in ("false", "0", "no")
794796

795797
if group_size in ["none", "None", "0"]:
796798
group_size = 0
797799

798800
group_size = int(group_size)
799801
bitwidth = int(bitwidth)
800-
is_asymmetric = bool(is_asymmetric)
801802
weight_dtype = getattr(torch, f"int{bitwidth}")
802803
granularity = PerAxis(0) if group_size == 0 else PerGroup(group_size)
803804
mapping_type = (

0 commit comments

Comments
 (0)