[Model]Support Step-3.7-Flash (#43859)
Signed-off-by: luotingdan <luotingdan@stepfun.com> Signed-off-by: Isotr0py <Isotr0py@outlook.com> Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai> Co-authored-by: luotingdan <luotingdan@stepfun.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Yu Huang <yuhuang@nvidia.com> Co-authored-by: Jee Jee Li <jeejeelee@inferact.ai>
This commit is contained in:
co-authored by
luotingdan
Isotr0py
Yu Huang
Jee Jee Li
parent
325a1ec4fb
commit
b690b2bb67
@@ -637,6 +637,54 @@ class Step3p5Model(nn.Module):
|
||||
(f".moe.experts.{base_layer}w13_weight", ".moe.gate_proj.weight", "w1"),
|
||||
(f".moe.experts.{base_layer}w13_weight", ".moe.up_proj.weight", "w3"),
|
||||
(f".moe.experts.{base_layer}w2_weight", ".moe.down_proj.weight", "w2"),
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_weight_scale_2",
|
||||
".moe.gate_proj.weight_scale_2",
|
||||
"w1",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_weight_scale_2",
|
||||
".moe.up_proj.weight_scale_2",
|
||||
"w3",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w2_weight_scale_2",
|
||||
".moe.down_proj.weight_scale_2",
|
||||
"w2",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_weight_scale",
|
||||
".moe.gate_proj.weight_scale",
|
||||
"w1",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_weight_scale",
|
||||
".moe.up_proj.weight_scale",
|
||||
"w3",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w2_weight_scale",
|
||||
".moe.down_proj.weight_scale",
|
||||
"w2",
|
||||
),
|
||||
# Required due to the Step3 HF model's packed expert format:
|
||||
# input scales are stored as moe.{gate,up,down}_proj.input_scale
|
||||
# rather than the standard per-expert format handled generically.
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_input_scale",
|
||||
".moe.gate_proj.input_scale",
|
||||
"w1",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w13_input_scale",
|
||||
".moe.up_proj.input_scale",
|
||||
"w3",
|
||||
),
|
||||
(
|
||||
f".moe.experts.{base_layer}w2_input_scale",
|
||||
".moe.down_proj.input_scale",
|
||||
"w2",
|
||||
),
|
||||
]
|
||||
|
||||
# New per-expert format: .moe.experts.E.gate_proj.weight_packed [out, in]
|
||||
@@ -756,7 +804,11 @@ class Step3p5Model(nn.Module):
|
||||
# Per-tensor global scales (e.g. weight_global_scale)
|
||||
# have shape [1] in compressed-tensors NVFP4 checkpoints.
|
||||
# Expand to per-expert before the iteration loop.
|
||||
if (
|
||||
if loaded_weight.ndim == 0:
|
||||
loaded_weight = loaded_weight.unsqueeze(0).expand(
|
||||
moe_expert_num
|
||||
)
|
||||
elif (
|
||||
loaded_weight.shape[0] == 1
|
||||
and loaded_weight.shape[0] != moe_expert_num
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user