diff --git a/03.MindSpore_Compatible_Training_Course/Chapter3/finetune.md b/03.MindSpore_Compatible_Training_Course/Chapter3/finetune.md index adf041c..4709833 100644 --- a/03.MindSpore_Compatible_Training_Course/Chapter3/finetune.md +++ b/03.MindSpore_Compatible_Training_Course/Chapter3/finetune.md @@ -6,11 +6,12 @@ | 依赖软件 | 版本 | |:------------------|:-------| | CANN | 8.2RC1 | +| NNAL |8.2.RC1 | | Python | 3.10 | | MindSpore | 2.7.1 | | MindSpeed-Core-MS | r0.4.0 | -[dockerfile_unified](./dockerfiles/dockfile_unified)中打入了**CANN**与**Python**, 开发者可基于此镜像或任何包含指定**CANN**和**Python**版本的环境中完成实验。 +[dockerfile_unified](./dockerfiles/dockfile_unified)中打入了**CANN**与**Python**, 开发者可基于此镜像或任何包含指定**CANN**和**Python**版本的环境中完成实验。其中NNAL安装请参考[NNAL安装](https://www.hiascend.com/document/detail/zh/canncommercial/82RC1/softwareinst/instg/instg_0008.html?Mode=PmIns&InstallType=local&OS=openEuler&Software=cannToolKit#ZH-CN_TOPIC_0000002396687965__Software-cannToolKit-cannNNAE)。 其他依赖安装参考以下步骤。 ## MindSpore安装 @@ -93,10 +94,32 @@ python examples/qwen2vl/llava_instruct_2_mllm_demo_format.py ## 4. 微调 +- 修改examples/mindspore/qwen2.5vl/finetune_qwen2_5_vl_7b_lora.sh脚本,参考如下: +```bash +TP=1 +PP=4 +CP=1 +``` +- 修改examples/mindspore/qwen2.5vl/model_7b.json文件,其中pipeline配置要和权重转换中的pipeline配置一致,参考如下: +```bash +"vision_encoder": { + ... + "pipeline_num_layers": [32,0,0,0], + ... + } + + "text_decoder": { + ... + "pipeline_num_layers":[1,10,10,7] + ... + } +``` - 运行微调命令 ```bash mkdir save_dir bash examples/mindspore/qwen2.5vl/finetune_qwen2_5_vl_7b_lora.sh ``` -运行日志保存在msrun_log/worker_7.log中 \ No newline at end of file +运行日志保存在msrun_log/worker_7.log中 + +更多参数配置使用可参考[此处](https://gitcode.com/Ascend/MindSpeed-MM/tree/master/examples/mindspore/qwen2.5vl)。 \ No newline at end of file diff --git a/03.MindSpore_Compatible_Training_Course/Chapter5/partition-strategy.md b/03.MindSpore_Compatible_Training_Course/Chapter5/partition-strategy.md index 690ca75..9040429 100644 --- a/03.MindSpore_Compatible_Training_Course/Chapter5/partition-strategy.md +++ b/03.MindSpore_Compatible_Training_Course/Chapter5/partition-strategy.md @@ -180,3 +180,8 @@ bash examples/mindspore/qwen25/pretrain_qwen25_7b_32k_ms.sh | TP4PP2 | 126 | 27951 | PP=2 显著减少了流水线气泡,TP=4 提高了计算效率,吞吐量得到提高;显存占用因 PP 减少而大幅降低。 | | TP4PP2+Recompute | 99 | 26779 | 重计算以时间换空间,显著降低了显存占用(低于 tp4pp2),但增加了前向计算量,导致吞吐量明显下降。 | +| 配置 | 吞吐量 | 峰值显存 | 主要影响因素 | +| :--- | :--- | :--- | :--- | +| TP2PP2 | | oom | +| TP2PP2 Ulysses | 144 | 62350 |序列并行可以利用多个计算设备对输入序列进行并行切分,降低单设备的内存消耗。Ulysses 的All-to-All 通信模式需要在每个设备上缓存更多的中间结果或进行更复杂的张量重组,导致显存开销更大。 +| TP2PP2 Ring Attention | 162 | 57658 |Ring Attention 通过环形通信减少了通信延迟和带宽压力,使得计算和通信可以更好地重叠,从而提高了整体的处理速度和吞吐量。