From 9669b3601034709608510e627c40160b69210550 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 1 Jun 2025 23:29:16 +0300 Subject: [PATCH] SDNQ fix older PyTorch with FP8 matmul --- modules/model_quant_sdnq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/model_quant_sdnq.py b/modules/model_quant_sdnq.py index 6adfe7b73..5b5bc1c60 100644 --- a/modules/model_quant_sdnq.py +++ b/modules/model_quant_sdnq.py @@ -432,7 +432,7 @@ def fp8_matmul( output_shape = list(input.shape) output_shape[-1] = weight.shape[-1] input, input_scale = quantize_fp8_matmul_input(input) - return torch._scaled_mm(input, weight, input_scale, scale, bias=bias, out_dtype=return_dtype).reshape(output_shape) + return torch._scaled_mm(input, weight, scale_a=input_scale, scale_b=scale, bias=bias, out_dtype=return_dtype).reshape(output_shape) # sm89 doesn't support row wise scale in Windows @@ -447,7 +447,7 @@ def fp8_matmul_tensorwise( output_shape[-1] = weight.shape[-1] dummy_input_scale = torch.ones(1, device=input.device, dtype=torch.float32) input, scale = quantize_fp8_matmul_input_tensorwise(input, scale) - result = decompress_symmetric(torch._scaled_mm(input, weight, dummy_input_scale, dummy_input_scale, bias=None, out_dtype=scale.dtype), scale, return_dtype, output_shape) + result = decompress_symmetric(torch._scaled_mm(input, weight, scale_a=dummy_input_scale, scale_b=dummy_input_scale, bias=None, out_dtype=scale.dtype), scale, return_dtype, output_shape) if bias is not None: result.add_(bias) return result