Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
孙桢波 d2e3e037fc | 4 months ago | |
---|---|---|
src | 4 months ago | |
README.md | 4 months ago | |
aic-ascend910-ops-info.json | 9 months ago | |
ma-pre-start.sh | 4 months ago | |
parallel_speedup.json | 9 months ago | |
run_llama2.py | 4 months ago |
我们提供了Llama 7B的模型,要求选手在不修改模型结构和训练参数的情况下,通过优化和调整并行策略来提高训练的效率。
我们提供的模型为Llama 7B,词表采用了Baichuan2的词表,训练的文本长度为4096。请选手在训练中设置mode
参数为7B
,且不要修改代码中对模型层数、head数目等配置,保证模型的总参数量不发生变化。
我们提供了Belle数据集,由Baichuan2处理得到。请在训练任务中设置dataset_name
为belle
。不要额外处理数据集的内容。
请采用mindspore2.0-cann6-for-xianxing
,该镜像的mindspore版本为2.0 beta,请参考mindspore的2.0版本的文档。
训练中我们还需要保证训练精度的配置。整体上是用fp16来进行训练,但是Layernorm和Softmax算子是用fp32来训练。
每个迭代总共的batch size大小要求为32,其计算方法为data parallel * micro_batch_num * per_batch_size
。
由于并行策略的修改,模型参数初始化可能存在区别,所以loss数值不完全相同。但是loss曲线在整体趋势和误差上不应相差太大。
目前mindspore支持张量并行、数据并行、优化器并行和流水并行。
op_level_model_parallel_num
stage_num
来配置。但是具体的计算图切分策略可以由选手自己指定,通过配置模块的pipeline
来设置micro_size
optimizer_shard
,其大小应小于等于数据并行的大小重计算是通过舍弃前向过程中的中间结果,在反向重新计算来节省显存。
选手可以根据具体的显存用量决定是否采用全部重计算(参数为recompute
),选择重计算(参数为select_recompute
),或者不重计算(默认配置)。进一步的,用户可以定义每个算子是否需要重计算来优化训练性能。
可以参考Flash Attention的论文,和MindSpore仓库中对flash attention的实现,将其移植到目前的代码中,优化该部分的计算。
选手可以参考相关论文引入其他优化,但是需要保证模型结构、收敛性不受到影响。
# 请不要修改
mode = 7B
full_batch = 0
dataset_name = belle
save_checkpoint = False
# 可以修改
op_level_model_parallel_num = 4
stage_num = 2
recompute = True
sequence_parallel = True
optimizer_shard = 2
micro_size = 16
No Description
Python Shell
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》