[hotfix] missing w13_weight_fp8 and w2_weight_fp8 in UE8M0 requantization (#12259)
This commit is contained in:
@@ -3289,8 +3289,8 @@ class DeepseekV2ForCausalLM(nn.Module):
|
||||
experts = layer.mlp.experts
|
||||
if isinstance(experts, DeepEPMoE):
|
||||
for w in [
|
||||
experts.w13_weight_fp8,
|
||||
experts.w2_weight_fp8,
|
||||
(experts.w13_weight, experts.w13_weight_scale_inv),
|
||||
(experts.w2_weight, experts.w2_weight_scale_inv),
|
||||
]:
|
||||
requant_weight_ue8m0_inplace(w[0], w[1], weight_block_size)
|
||||
else:
|
||||
@@ -3338,10 +3338,26 @@ class DeepseekV2ForCausalLM(nn.Module):
|
||||
)
|
||||
|
||||
experts = layer.mlp.experts
|
||||
w13_weight_fp8 = (
|
||||
experts.w13_weight,
|
||||
(
|
||||
experts.w13_weight_scale_inv
|
||||
if hasattr(experts, "w13_weight_scale_inv")
|
||||
else experts.w13_weight_scale
|
||||
),
|
||||
)
|
||||
w2_weight_fp8 = (
|
||||
experts.w2_weight,
|
||||
(
|
||||
experts.w2_weight_scale_inv
|
||||
if hasattr(experts, "w2_weight_scale_inv")
|
||||
else experts.w2_weight_scale
|
||||
),
|
||||
)
|
||||
if isinstance(experts, DeepEPMoE):
|
||||
for w in [
|
||||
experts.w13_weight_fp8,
|
||||
experts.w2_weight_fp8,
|
||||
w13_weight_fp8,
|
||||
w2_weight_fp8,
|
||||
]:
|
||||
transform_scale_ue8m0_inplace(w[1], mn=w[0].shape[-2])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user