Thanks to visit codestin.com
Credit goes to github.com

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
5 changes: 4 additions & 1 deletion tutorials/calibration_flow/awq_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ def weight_quant_func(weight):
weight, weight_scale, weight_zero_point, block_size, target_dtype
)
elif target_dtype == torch.float8_e4m3fn:
scale_2d = (
weight_scale.view(1, -1) if weight_scale.dim() == 1 else weight_scale
)
return to_affine_quantized_floatx_static(
weight,
weight_scale,
scale_2d,
block_size,
target_dtype,
Float8Layout(mm_config=None),
Expand Down
2 changes: 1 addition & 1 deletion tutorials/calibration_flow/gptq_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
LinearActivationQuantizedTensor,
MappingType,
PerTensor,
_fake_quantize_affine,
quantize_,
to_linear_activation_quantized,
)
from torchao.quantization.quant_api import _replace_with_custom_fn_if_matches_filter
from torchao.quantization.quant_primitives import _fake_quantize_affine
from torchao.quantization.transform_module import (
register_quantize_module_handler,
)
Expand Down
Loading