[Bugfix] Canonicalize FP8 weight layout to (K, N) at the source (#44735)
Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
@@ -75,25 +75,7 @@ class MarlinFP8ScaledMMLinearKernel(FP8ScaledMMLinearKernel):
|
||||
# Update layer with new values
|
||||
replace_parameter(layer, "weight", weight.data)
|
||||
replace_parameter(layer, "weight_scale_inv", weight_scale_inv.data)
|
||||
else:
|
||||
w_q, *_ = self._get_layer_params(layer)
|
||||
# Compressed tensors transposes the weight to (K, N)
|
||||
# for channel and tensor quant strategies.
|
||||
# So we can skip the transpose if the layout is
|
||||
# already (K, N).
|
||||
# TODO: Remove this check once the layouts have been
|
||||
# canonicalized to a standard (N, K) dimension. See issue
|
||||
# #33314 for more details.
|
||||
if w_q.shape != (
|
||||
layer.input_size_per_partition,
|
||||
layer.output_size_per_partition,
|
||||
):
|
||||
# transpose the weights to (K,N)
|
||||
replace_parameter(
|
||||
layer,
|
||||
"weight",
|
||||
w_q.t(),
|
||||
)
|
||||
# Non-block: callers must pass weight in (K, N) layout.
|
||||
|
||||
layer.input_scale = None
|
||||
prepare_fp8_layer_for_marlin(
|
||||
|
||||
Reference in New Issue
Block a user