Skip to content

Commit cfcc43b

Browse files
authored
Add CONTRIBUTING_zh.md (#59)
1 parent a2ba986 commit cfcc43b

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

CONTRIBUTING_zh.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# 贡献指南
2+
3+
## 贡献流程
4+
5+
1. 在本仓库提交 Pull Request 并得到充分验证
6+
2. Pull Request 合入并稳定运行后再同步提交到 [pytorch-fdn/oota][0]
7+
8+
[0]: https://github.com/pytorch-fdn/oota
9+
10+
## 整体流程
11+
12+
触发任务后,会依次执行下列子工作流:
13+
14+
1. 编译 torch
15+
16+
- 只有监听到上游 PyTorch 仓库 PR 事件时,才会基于上游 PR 的代码源码编译 torch
17+
- 否则会安装 torch_npu [requirements.txt][1] 中指定的 torch 版本
18+
19+
2. 编译 torch_npu
20+
21+
- 核心是执行 `bash torch_npu/ci/build.sh` 进行编译
22+
23+
3. 执行 torch_npu 单元测试
24+
25+
- 核心是执行 `python torch_npu/ci/access_control_test.py` 进行测试
26+
27+
4. 执行 torch_npu [torchbenchmark][2]
28+
29+
- 核心是执行 `python benchmark/run_benchmark.py test_bench` 进行测试
30+
- 周期触发时会自动将 TorchBenchmark 的测试结果提交 PR,例如:[#46][3]
31+
32+
5. 执行其他 PyTorch 生态项目测试(如 [torchtitan][4], [torchtune][5], [torchchat][6]
33+
34+
[1]: https://github.com/Ascend/pytorch/blob/master/requirements.txt
35+
[2]: https://github.com/pytorch/benchmark
36+
[3]: https://github.com/cosdt/pytorch-integration-tests/pull/46
37+
[4]: https://github.com/pytorch/torchtitan
38+
[5]: https://github.com/pytorch/torchtune
39+
[6]: https://github.com/pytorch/torchchat
40+
41+
## 工作流触发条件
42+
43+
torch_npu 测试总入口工作流文件在 [.github/workflows/ascend_npu_test.yml](.github/workflows/ascend_npu_test.yml)
44+
其触发条件为:
45+
46+
1. `pull_request` 触发
47+
2. `workflow_dispatch` 手动触发
48+
3. `schedule` 周期触发
49+
4. `pytorch-pr-event-redispatch` 事件触发
50+
51+
其区别如下:
52+
53+
| 事件类型 | 工作流所在分支 | 触发时机 | 是否源码编译 torch |
54+
| :-------------------------: | :------------: | :------------------------------------------: | :----------------: |
55+
| pull_request | pr-branch | 提交 PR 时 ||
56+
| workflow_dispatch | main | 手动触发 ||
57+
| schedule | main | 每晚定期触发 1 次 ||
58+
| pytorch-pr-event-redispatch | main | 每晚定期扫描 PyTorch 仓库的 PR,会触发此事件 ||
59+
60+
## 代码结构
61+
62+
```
63+
.
64+
├── ascend_npu // Ascend NPU 配置/文档等
65+
├── .ci // CI 配置/文档等
66+
├── .github
67+
│ ├── actions // 自定义 action
68+
│ └── workflows // 工作流文件
69+
│ ├── ascend_npu_test.yml // torch_npu 测试总入口
70+
│ ├── _ascend_npu_build_torch.yml // torch 编译子工作流
71+
│ ├── _ascend_npu_build_torch_npu.yml // torch_npu 编译子工作流
72+
│ ├── _ascend_npu_ut.yml // torch_npu ut 子工作流
73+
│ ├── _ascend_npu_benchmark.yml // torch_npu benchmark 子工作流
74+
│ ├── dispatch-event.yml // 监听上游 PR 事件并分发
75+
│ └── redispatch-event.yml // 重新分发 PR 事件至其他仓库
76+
├── requirements.txt // 本项目依赖的 python 包
77+
├── src
78+
│ └── benchmark // TorchBenchmark 流程代码
79+
└── test // 测试代码
80+
```

0 commit comments

Comments
 (0)