Skip to content

Conversation

YuanRisheng
Copy link
Collaborator

@YuanRisheng YuanRisheng commented Aug 20, 2025

新loader支持加载ernie模型:
以28B模型h20测试结果如下:

旧版loader 旧版loader 新版loader
单线程内存占用 60G 5G
单线程加载耗时 74秒 43秒
4线程内存占用 80G 32G
4线程加载耗时 67秒 68秒

新Loader相比旧Loader单卡节省90%左右的内存占用,加载性能提升40%,多卡加载性能基本持平

Copy link

paddle-bot bot commented Aug 20, 2025

Thanks for your contribution!

Comment on lines +568 to +579
def gate_correction_bias_loader(self, params_dict, loaded_weight_name, loaded_weight):
text_param_name = loaded_weight_name.replace(
"moe_statics.e_score_correction_bias", "text_fused_moe.experts.gate_correction_bias"
)
image_param_name = loaded_weight_name.replace(
"moe_statics.e_score_correction_bias", "image_fused_moe.experts.gate_correction_bias"
)
text_param = params_dict[text_param_name]
image_param = params_dict[image_param_name]
loaded_weight = get_tensor(loaded_weight)
text_param.copy_(loaded_weight[0].unsqueeze(0), False)
image_param.copy_(loaded_weight[1].unsqueeze(0), False)
Copy link
Collaborator

@yuanlehome yuanlehome Aug 21, 2025

Choose a reason for hiding this comment

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

这个写在load_weights函数里面是不是更好,它不是model对外开放的一个接口

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

好的,我下个PR修改一下

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit 85fbf54 into PaddlePaddle:develop Aug 22, 2025
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants