Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/mcore_bridge/model/gpts/qwen3_next_gdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ def build_model(
lm_model = model.language_model if hasattr(model, 'language_model') else model
for layer in lm_model.decoder.layers:
if hasattr(layer.self_attention, 'out_norm'):
assert hasattr(layer.self_attention.out_norm, 'zero_centered_gamma')
layer.self_attention.out_norm.zero_centered_gamma = False
out_norm = layer.self_attention.out_norm
if hasattr(out_norm, 'zero_centered_gamma'):
out_norm.zero_centered_gamma = False
elif hasattr(out_norm, 'config'):
out_norm.config.layernorm_zero_centered_gamma = False
Comment on lines +144 to +145
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在访问 out_norm.config.layernorm_zero_centered_gamma 之前,建议增加对该属性是否存在的检查。虽然在昇腾 NPU 环境下 MindSpeed 的 RMSNorm 预期包含此配置,但为了代码的健壮性,防止在其他环境或不同版本的配置对象上触发 AttributeError,使用 hasattr 检查会更安全。此外,由于 config 对象通常在多个层之间共享,修改此属性可能会产生全局影响,请确认这是否符合预期。

Suggested change
elif hasattr(out_norm, 'config'):
out_norm.config.layernorm_zero_centered_gamma = False
elif hasattr(out_norm, 'config') and hasattr(out_norm.config, 'layernorm_zero_centered_gamma'):
out_norm.config.layernorm_zero_centered_gamma = False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config参数是共享的,会导致其他所有的 config.layernorm_zero_centered_gamma都为False。

但我记得只有 out_norm 需要是 layernorm_zero_centered_gamma 为False

Copy link
Copy Markdown
Author

@Weizhena Weizhena May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好,感谢回复!现在希望qwen3.6-27b 训练,验证发现确实不对,现在采取
import copy
if hasattr(layer.self_attention, 'out_norm'):
out_norm = layer.self_attention.out_norm
if hasattr(out_norm, 'zero_centered_gamma'):
out_norm.zero_centered_gamma = False
elif hasattr(out_norm, 'config'):
out_norm.config = copy.copy(out_norm.config)
out_norm.config.layernorm_zero_centered_gamma = False
return model

                这样改动是否能暂时正确运行?   经过这样的改动方式,sft首轮loss从13调到了1.4

return model


Expand Down
1 change: 1 addition & 0 deletions src/mcore_bridge/model/modules/gated_delta_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def forward(
stride=self.conv1d.stride,
padding=self.conv1d.padding,
dilation=self.conv1d.dilation,
groups=qkv.shape[1],
)
qkv = self.act_fn(conv_out[..., :seq_len])
qkv = qkv.transpose(1, 2) # b, d, s -> b, s, d
Expand Down
4 changes: 2 additions & 2 deletions src/mcore_bridge/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Make sure to modify __release_datetime__ to release time when making official release.
__version__ = '1.4.0.dev0'
__version__ = '1.4.0'
# default release datetime for branches under active development is set
# to be a time far-far-away-into-the-future
__release_datetime__ = '2099-12-31 23:59:59'
__release_datetime__ = '2026-05-17 23:59:59'
Loading