昇腾故障案例详情页

训练GPT2-13B大模型时报错ValueError: For 'AdamWeightDecay', the 'var_shape' should be = grad_shape: [1], but got [2560]

2024/02/22

73

暂无评分

问题信息

问题来源产品大类产品子类关键字
官方模型训练MindSpore训练GPT2-13B、AdamWeightDecay

问题现象描述

训练GPT2-13B大模型时报错ValueError: For 'AdamWeightDecay', the 'var_shape' should be = grad_shape: [1], but got [2560]

ms版本:1.9.0

开源代码路径:https://gitee.com/mindspore/mindformers/tree/dev

原因分析

AdamweightDecay优化器切分时不正确,可能是ms版本bug。

排查方法

确认run_gpt2_13b.yaml文件中optimizer_shard是否为True。

解决措施

需要将run_gpt2_13b.yaml中的optimizer_shard设置为False,但这样会增加内存消耗。

建议使用ms1.9.1及之后版本,同时将optimizer_shard设置为True。

本页内容

该页面对您有帮助吗?
我要评分