问题现象描述
训练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。



