Pull Request已成功合入, 合并人@ascend-robot
(感谢 xubin 的贡献)变更摘要
本次 PR 主要针对 FSDP2 后端模型,将 MindSpeed 依赖的拉取方式统一改为始终获取 master 分支最新代码。核心变更包括:在 scripts/install.sh 中新增 --msbranch 参数以支持按分支安装 MindSpeed,并修复了 CANN 安装环节的错误码捕获 bug;同时将 10 个 FSDP2 相关示例 README 中的 MindSpeed 安装指令统一改为拉取 master 分支。
主要改动
scripts/install.sh新增-b/--msbranch参数:允许用户通过分支名指定 MindSpeed 版本,与原有的--msid(指定 commit ID)互斥;同时传入时脚本报错退出,并更新了帮助信息和配置打印逻辑,按 branch / commit / latest 三种状态分别输出。- MindSpeed 克隆与切换逻辑适配分支模式:新克隆时若指定
--msbranch,使用git clone -b "$MINDSPEED_BRANCH"一步完成;当 MindSpeed 目录已存在时,执行git fetch origin <branch>+git checkout <branch>以确保分支代码为最新。 - CANN 安装错误处理 bug 修复:原写法
if ! cmd; then cann_exit_code=$?中$?被if命令自身的退出码覆盖,导致失败退出码恒为 0;改为先执行命令再取$?后判断,使 CANN 安装失败能被正确捕获并终止流程。 - FSDP2 后端 README 统一 MindSpeed 拉取方式为 master 分支:在
examples/目录下 10 个 FSDP2 相关 README 中,将 MindSpeed 安装指令统一改为拉取master分支(使用--msbranch master或git clone -b master);其中qwen3vl和qwen3omni目录按规则仅修改README_v1.md,保留README.md不动。


代码审查
I've now thoroughly reviewed all 11 changed files. Let me provide the closing summary.
审查总结
审查结果统计
- P0: 0
- P1: 1 (scripts/install.sh:
git fetch+git checkout未更新本地分支到远程最新) - P2: 0
- P3: 0
各文件审查结论
| 文件 | 结论 |
|---|---|
scripts/install.sh |
1 个问题 — git fetch + git checkout 未真正更新分支(P1);CANN 退出码修复正确;--msbranch / --msid 互斥逻辑正确 |
examples/kimik2_5/README.md |
无新增问题(--msbranch master 替换正确;bash pip install 为既有错误,非本 diff 引入) |
examples/ltx2/README.md |
无问题(git clone -b master 替换正确) |
examples/mimov2_5/README.md |
无问题(--msid eb10b92 → --msbranch master 替换正确) |
examples/moss_tts/README.md |
无问题(git clone -b master 替换正确) |
examples/qwen3_5/README.md |
无问题(--msid eb10b92 → --msbranch master 替换正确) |
examples/qwen3_6/README.md |
无问题(--msid eb10b92 → --msbranch master 替换正确) |
examples/qwen3omni/README_v1.md |
无问题(git clone -b master 替换正确;README.md 按预期未改动) |
examples/qwen3tts/README.md |
无问题(git clone -b master 替换正确) |
examples/qwen3vl/README_v1.md |
无问题(git clone -b master 替换正确;README.md 按预期未改动) |
examples/step3_vl/README.md |
无问题(git clone -b master 替换正确) |
整体风险判断
中等风险。核心缺陷在于 scripts/install.sh 第 596-599 行的 git fetch + git checkout 组合无法将已存在的本地分支更新到远程最新提交,导致"每次都拉取最新 master 分支代码"的设计目标在第二次及之后的运行中失效——用户将安装过时的 MindSpeed 代码,而非预期的最新 master。建议在 git checkout 之后追加 git reset --hard "origin/$MINDSPEED_BRANCH"(或在 fetch 后直接使用 git checkout -B "$MINDSPEED_BRANCH" "origin/$MINDSPEED_BRANCH")。其余 README 变更均为简单直接的参数/命令替换,无安全或正确性问题。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/MindSpeed-MM | ✅ 王海涛, wanglikai1019, gaojie_ (3/2) | ✅ 王海涛 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
MoCuishle-M, thanks for your pull request. All authors of the commits have signed the CLA. 👍


ascend docs pipeline is running...


ascend docs pipeline is running...


🟠 High Priority
PR 目标为"每次都拉取最新的 MindSpeed master 分支代码",但现有实现中,当 MindSpeed 目录已存在时:
git fetch origin "$MINDSPEED_BRANCH"— 从远程拉取最新提交,更新origin/<branch>引用git checkout "$MINDSPEED_BRANCH"— 切换到本地同名分支,但不会合并origin/<branch>的更新
结果:本地分支仍停留在上次运行时的提交,不会更新到远程最新。后续 pip3 install -e . 安装的仍是旧代码。首次运行(无现有目录)时 git clone -b 可以拿到最新;但第二次及之后的运行就会安装过时版本,违背了"每次都拉取最新"的意图。
触发条件:用户第二次执行 bash scripts/install.sh --msbranch master 且 MindSpeed 目录已存在。
建议:在 git checkout 后将本地分支重置到远程最新,或使用 git checkout -B 强制重建分支到 origin 的最新位置。
|
599 | + if [ -n "$MINDSPEED_BRANCH" ]; then |
|
600 | + # For existing clone, fetch and checkout the branch to keep it up to date |
|
601 | + git fetch origin "$MINDSPEED_BRANCH" |
| 599
| - git checkout "$MINDSPEED_BRANCH" |
|
602 | + git checkout "$MINDSPEED_BRANCH" |
|
603 | + git reset --hard "origin/$MINDSPEED_BRANCH" |


ascend docs pipeline is running...


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build | ✅ | >>> |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | Only_doc_commit | ✅ | >>> |
| codeCheck_pre-commit | ✅ | >>> | |
| pre-commit | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT | ✅ | >>> |
| ST | ✅ | >>> | |
| 流水线 | PR-pipeline_MindSpeed-MM | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


/lgtm


/lgtm


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


What this PR does / why we need it?
使用 fsdp2 后端的模型,修改成每次都拉取最新的MindSpeed ${指定分支} 代码
详细变更
通过在 examples/ 目录搜索 torchrun $DISTRIBUTED_ARGS mindspeed_mm/fsdp/train/trainer.py 定位 fsdp2 后端的 example,统一拉取方式为 ${指定分支} 分支:
使用 bash scripts/install.sh 的 README:追加 --msbranch ${指定分支} (原 --msid eb10b92 因互斥改为替换)
使用手动 git clone 的 README:改为 git clone -b ${指定分支} https://gitcode.com/Ascend/MindSpeed.git
qwen3vl 、 qwen3omni 目录下同时存在 README.md 和 README_v1.md ,按规则只修改 README_v1.md ,保持 README.md 不动
涉及文件(共 10 个 README + 1 个脚本):
scripts/install.sh
examples/qwen3_6/README.md 、 examples/qwen3_5/README.md 、 examples/kimik2_5/README.md 、 examples/mimov2_5/README.md
examples/step3_vl/README.md 、 examples/qwen3tts/README.md 、 examples/moss_tts/README.md 、 examples/ltx2/README.md
examples/qwen3vl/README_v1.md 、 examples/qwen3omni/README_v1.md
Does this PR introduce any user-facing change?
是。带来以下用户可见变化:
相关文档路径:
How was this patch tested?
验证方式
参数解析与互斥校验
已有克隆场景
CANN 错误处理
README 一致性
使用约束与限制