Fix eplb nvfp4 experts hook (#37217)
Signed-off-by: Elvir Crncevic <elvircrn@gmail.com> Signed-off-by: Elvir Crncevic <elvir@anthropic.com> Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Tyler Michael Smith
Claude Opus 4.6
parent
c0f011918d
commit
fd4d96302a
@@ -570,6 +570,7 @@ class CompressedTensorsW4A4Nvfp4MoEMethod(CompressedTensorsMoEMethod):
|
||||
shared_experts=layer.shared_experts,
|
||||
routing_tables=layer._maybe_init_expert_routing_tables(),
|
||||
)
|
||||
self.moe_kernel.fused_experts.process_weights_after_loading(layer)
|
||||
|
||||
def maybe_make_prepare_finalize(
|
||||
self,
|
||||
|
||||
@@ -1394,6 +1394,7 @@ class ModelOptNvFp4FusedMoE(FusedMoEMethodBase):
|
||||
shared_experts=layer.shared_experts,
|
||||
routing_tables=layer._maybe_init_expert_routing_tables(),
|
||||
)
|
||||
self.moe_kernel.fused_experts.process_weights_after_loading(layer)
|
||||
|
||||
def get_fused_moe_quant_config(self, layer: torch.nn.Module) -> FusedMoEQuantConfig:
|
||||
return make_nvfp4_moe_quant_config(
|
||||
|
||||
@@ -267,16 +267,6 @@ def prepare_nvfp4_moe_layer_for_fi_or_cutlass(
|
||||
num_experts=w13.size(0),
|
||||
is_gated_activation=is_gated,
|
||||
)
|
||||
|
||||
# We do not need to make this a parameter, because
|
||||
# it is not used during the weight (re)-loading process.
|
||||
if is_gated:
|
||||
layer.g1_scale_c = a13_scale * w13_scale_2 / a2_scale
|
||||
else:
|
||||
layer.g1_scale_c = torch.ones_like(a13_scale) / a2_scale
|
||||
layer.a1_gscale = 1.0 / a13_scale
|
||||
layer.g1_alphas = a13_scale * w13_scale_2
|
||||
layer.g2_alphas = a2_scale * w2_scale_2
|
||||
else:
|
||||
# Swizzle the block scales for other FI NVFP4 MoE kernels.
|
||||
w13_scale = swizzle_blockscale(w13_scale)
|
||||
|
||||
Reference in New Issue
Block a user