下载
中文
注册
训练GPT2-13B大模型时报错ValueError: GPT2LMHEADMoel:The product of the data parallel 4, model parallel 4 pipeline stages 4 should be less than device_num 16.

训练GPT2-13B大模型时报错ValueError: GPT2LMHEADMoel:The product of the data parallel 4, model parallel 4 pipeline stages 4 should be less than device_num 16.

2024/02/22

199

暂无评分
我要评分

问题信息

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

问题现象描述

训练GPT2-13B大模型时报错ValueError: GPT2LMHEADMoel:The product of the data parallel 4, model parallel 4 pipeline stages 4 should be less than device_num 16.

放大

ms版本:1.9.1

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

原因分析

可能是run_gpt2_13b.yaml文件中data_parallel,model_parallel,pipeline_stage等参数设置不合理导致。

排查方法

确认run_gpt2_13b.yaml文件中data_parallel,model_parallel,pipeline_stage设置是否符合要求:dp*mp*pp要小于总卡数,micro_batch_num要大于等于pp。num_layers被pp整除,num_heads和embedding_size也要被mp整除

解决措施

1.data_parallel* model_parallel *pipeline_stage要小于总卡数;

2.model_parallel的值往data_parallel上分,同时batch_size尽量大一点(一般4/8/12等),16卡建议pipeline_stage为2,32卡建议pipeline_stage为4;

本页内容