已合并
modify license to Apache2.0 #32
modify license to Apache2.0 #32
已合并
zhangky创建于 2025年10月25日
48 个文件变更+435-173
MLICENSE+188-24
@@ -1,38 +1,202 @@
1-CANN Open Software License Agreement Version 2.0
2 1 
3-This CANN Open Software License Agreement Version 2.0 (hereinafter referred to as this "Agreement") is a legal agreement between you and Huawei, and it governs your use, modification, or distribution of CANN Open Software (hereinafter referred to as "Software"). Please read this Agreement carefully.2+ Apache License
3+ Version 2.0, January 2004
4+ http://www.apache.org/licenses/
4 5 
5-If you are entering into this Agreement on behalf of a company or other legal entity, you represent that you have the legal authority to bind that entity to this Agreement, in which case "you" will mean the entity you represent.6+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 7 
7-BY DOWNLOADING, INSTALLING, OR USING THE SOFTWARE, YOU AGREE YOU HAVE FULLY UNDERSTOOD AND ACCEPTED THE TERMS CONTAINED HEREIN. IF YOU DO NOT AGREE TO ANY OF THE TERMS OF THIS AGREEMENT, OR IF YOU DO NOT QUALIFY FOR AGREEING TO THIS AGREEMENT, YOU ARE NOT AUTHORIZED TO AND SHALL NOT DOWNLOAD, INSTALL, OR MAKE ANY USE OF THE SOFTWARE.8+ 1. Definitions.
8 9 
9-1. Definition10+ "License" shall mean the terms and conditions for use, reproduction,
11+ and distribution as defined by Sections 1 through 9 of this document.
10 12 
11-1.1 Software means the APIs, source code files, binaries, and related documents of Compute Architecture for Neural Networks("CANN") that are licensable by Huawei, and provided and licensed under this Agreement.13+ "Licensor" shall mean the copyright owner or entity authorized by
14+ the copyright owner that is granting the License.
12 15 
13-1.2 Huawei AI Processors mean AI chipsets (i) branded with "Ascend", "Kirin"," Yueying" or other brands owned or controlled by Huawei; or (ii) manufactured (including have manufactured), supplied (including have supplied) or designed (including have designed) by Huawei.16+ "Legal Entity" shall mean the union of the acting entity and all
17+ other entities that control, are controlled by, or are under common
18+ control with that entity. For the purposes of this definition,
19+ "control" means (i) the power, direct or indirect, to cause the
20+ direction or management of such entity, whether by contract or
21+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22+ outstanding shares, or (iii) beneficial ownership of such entity.
14 23 
15-2. Grant of Intellectual Property Rights24+ "You" (or "Your") shall mean an individual or Legal Entity
16-2.1 Subject to the terms and conditions of this Agreement, including your full compliance thereof, Huawei hereby grants you a limited, worldwide, royalty-free, non-transferable, non-sublicensable, and revocable license for you to (i) download, use, modify, integrate, and distribute the Software or its derivative works for the purpose of developing software solely for use in systems with Huawei AI Processors and/or Software, and (ii) distribute any software developed based upon Software and/or its derivative works solely for use in systems with Huawei AI Processors and/or Software.25+ exercising permissions granted by this License.
17 26 
18-3. Restrictions27+ "Source" form shall mean the preferred form for making modifications,
19-3.1 You are not authorized to, and shall not use, modify, or distribute this Software or its derivative works for any other purposes than those expressly permitted by this Agreement. You shall not make any use of the Software or its derivative works to develop or distribute any software for use in systems with processors other than Huawei AI Processors. All rights not expressly granted herein are expressly reserved by Huawei.28+ including but not limited to software source code, documentation
29+ source, and configuration files.
20 30 
21-3.2 You are not authorized to, and shall not remove, obscure, or alter any copyright or other notices in this Software or any part of it.31+ "Object" form shall mean any form resulting from mechanical
32+ transformation or translation of a Source form, including but
33+ not limited to compiled object code, generated documentation,
34+ and conversions to other media types.
22 35 
23-3.3 Distribution Restrictions36+ "Work" shall mean the work of authorship, whether in Source or
24-You may distribute the Software or its derivative works in any medium, whether in source or executable forms, for the purpose stipulated in Section 2; provided that you provide recipients with a copy of this Agreement, and retain all notices in the Software.37+ Object form, made available under the License, as indicated by a
38+ copyright notice that is included in or attached to the work
39+ (an example is provided in the Appendix below).
25 40 
26-4. Disclaimer of Warranty and Limitation of Liability41+ "Derivative Works" shall mean any work, whether in Source or Object
27-THE SOFTWARE IS PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL HUAWEI OR ANY OTHER COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE, IN WHOLE OR IN PART, NO MATTER HOW IT IS CAUSED OR THE LEGAL THEORY IT IS BASED ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.42+ form, that is based on (or derived from) the Work and for which the
43+ editorial revisions, annotations, elaborations, or other modifications
44+ represent, as a whole, an original work of authorship. For the purposes
45+ of this License, Derivative Works shall not include works that remain
46+ separable from, or merely link (or bind by name) to the interfaces of,
47+ the Work and Derivative Works thereof.
28 48 
29-5. Termination49+ "Contribution" shall mean any work of authorship, including
30-5.1 This Agreement will continue to apply until terminated by either you or Huawei as described below:50+ the original version of the Work and any modifications or additions
31-a.You may terminate this Agreement by ceasing your use of the Software;51+ to that Work or Derivative Works thereof, that is intentionally
32-b. Huawei may at any time, terminate this Agreement if: (i) you fail to comply with any term of this Agreement; or (ii) you directly or indirectly initiate any legal proceeding against any individual or entity by alleging that the Software or any part of it infringes your intellectual property rights.52+ submitted to Licensor for inclusion in the Work by the copyright owner
33-5.2 By termination, all the rights granted to you under this Agreement are terminated, and you shall cease to use and delete this Software or any derivative works immediately. All rights granted to you under this Agreement shall hereby be void ab initio in the event of termination in accordance with Section 5.1. b above. Huawei reserves the right to pursue any and all legal remedies available to enforce the terms and conditions of this Agreement or to protect Huawei’s intellectual property rights for such breach or violation. All provisions shall survive the termination of this Agreement except for Section 2 and Section 3.3.53+ or by an individual or Legal Entity authorized to submit on behalf of
54+ the copyright owner. For the purposes of this definition, "submitted"
55+ means any form of electronic, verbal, or written communication sent
56+ to the Licensor or its representatives, including but not limited to
57+ communication on electronic mailing lists, source code control systems,
58+ and issue tracking systems that are managed by, or on behalf of, the
59+ Licensor for the purpose of discussing and improving the Work, but
60+ excluding communication that is conspicuously marked or otherwise
61+ designated in writing by the copyright owner as "Not a Contribution."
34 62 
35-6. MISCELLANEOUS63+ "Contributor" shall mean Licensor and any individual or Legal Entity
36-If the application of any provision of this Agreement to any particular facts or circumstances is held to be invalid or unenforceable by a court of competent jurisdiction, then (a) the validity and enforceability of such provision as applied to any other particular facts or circumstances and the validity of other provisions of this Agreement shall not in any way be affected or impaired thereby and (b) such provision shall be enforced to the maximum extent possible so as to affect the intent of the you and Huawei and reformed without further action by you and Huawei to the extent necessary to make such provision valid and enforceable.64+ on behalf of whom a Contribution has been received by Licensor and
65+ subsequently incorporated within the Work.
37 66 
38-END OF THE TERMS AND CONDITIONS67+ 2. Grant of Copyright License. Subject to the terms and conditions of
68+ this License, each Contributor hereby grants to You a perpetual,
69+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70+ copyright license to reproduce, prepare Derivative Works of,
71+ publicly display, publicly perform, sublicense, and distribute the
72+ Work and such Derivative Works in Source or Object form.
73+ 
74+ 3. Grant of Patent License. Subject to the terms and conditions of
75+ this License, each Contributor hereby grants to You a perpetual,
76+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77+ (except as stated in this section) patent license to make, have made,
78+ use, offer to sell, sell, import, and otherwise transfer the Work,
79+ where such license applies only to those patent claims licensable
80+ by such Contributor that are necessarily infringed by their
81+ Contribution(s) alone or by combination of their Contribution(s)
82+ with the Work to which such Contribution(s) was submitted. If You
83+ institute patent litigation against any entity (including a
84+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85+ or a Contribution incorporated within the Work constitutes direct
86+ or contributory patent infringement, then any patent licenses
87+ granted to You under this License for that Work shall terminate
88+ as of the date such litigation is filed.
89+ 
90+ 4. Redistribution. You may reproduce and distribute copies of the
91+ Work or Derivative Works thereof in any medium, with or without
92+ modifications, and in Source or Object form, provided that You
93+ meet the following conditions:
94+ 
95+ (a) You must give any other recipients of the Work or
96+ Derivative Works a copy of this License; and
97+ 
98+ (b) You must cause any modified files to carry prominent notices
99+ stating that You changed the files; and
100+ 
101+ (c) You must retain, in the Source form of any Derivative Works
102+ that You distribute, all copyright, patent, trademark, and
103+ attribution notices from the Source form of the Work,
104+ excluding those notices that do not pertain to any part of
105+ the Derivative Works; and
106+ 
107+ (d) If the Work includes a "NOTICE" text file as part of its
108+ distribution, then any Derivative Works that You distribute must
109+ include a readable copy of the attribution notices contained
110+ within such NOTICE file, excluding those notices that do not
111+ pertain to any part of the Derivative Works, in at least one
112+ of the following places: within a NOTICE text file distributed
113+ as part of the Derivative Works; within the Source form or
114+ documentation, if provided along with the Derivative Works; or,
115+ within a display generated by the Derivative Works, if and
116+ wherever such third-party notices normally appear. The contents
117+ of the NOTICE file are for informational purposes only and
118+ do not modify the License. You may add Your own attribution
119+ notices within Derivative Works that You distribute, alongside
120+ or as an addendum to the NOTICE text from the Work, provided
121+ that such additional attribution notices cannot be construed
122+ as modifying the License.
123+ 
124+ You may add Your own copyright statement to Your modifications and
125+ may provide additional or different license terms and conditions
126+ for use, reproduction, or distribution of Your modifications, or
127+ for any such Derivative Works as a whole, provided Your use,
128+ reproduction, and distribution of the Work otherwise complies with
129+ the conditions stated in this License.
130+ 
131+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132+ any Contribution intentionally submitted for inclusion in the Work
133+ by You to the Licensor shall be under the terms and conditions of
134+ this License, without any additional terms or conditions.
135+ Notwithstanding the above, nothing herein shall supersede or modify
136+ the terms of any separate license agreement you may have executed
137+ with Licensor regarding such Contributions.
138+ 
139+ 6. Trademarks. This License does not grant permission to use the trade
140+ names, trademarks, service marks, or product names of the Licensor,
141+ except as required for reasonable and customary use in describing the
142+ origin of the Work and reproducing the content of the NOTICE file.
143+ 
144+ 7. Disclaimer of Warranty. Unless required by applicable law or
145+ agreed to in writing, Licensor provides the Work (and each
146+ Contributor provides its Contributions) on an "AS IS" BASIS,
147+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148+ implied, including, without limitation, any warranties or conditions
149+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150+ PARTICULAR PURPOSE. You are solely responsible for determining the
151+ appropriateness of using or redistributing the Work and assume any
152+ risks associated with Your exercise of permissions under this License.
153+ 
154+ 8. Limitation of Liability. In no event and under no legal theory,
155+ whether in tort (including negligence), contract, or otherwise,
156+ unless required by applicable law (such as deliberate and grossly
157+ negligent acts) or agreed to in writing, shall any Contributor be
158+ liable to You for damages, including any direct, indirect, special,
159+ incidental, or consequential damages of any character arising as a
160+ result of this License or out of the use or inability to use the
161+ Work (including but not limited to damages for loss of goodwill,
162+ work stoppage, computer failure or malfunction, or any and all
163+ other commercial damages or losses), even if such Contributor
164+ has been advised of the possibility of such damages.
165+ 
166+ 9. Accepting Warranty or Additional Liability. While redistributing
167+ the Work or Derivative Works thereof, You may choose to offer,
168+ and charge a fee for, acceptance of support, warranty, indemnity,
169+ or other liability obligations and/or rights consistent with this
170+ License. However, in accepting such obligations, You may act only
171+ on Your own behalf and on Your sole responsibility, not on behalf
172+ of any other Contributor, and only if You agree to indemnify,
173+ defend, and hold each Contributor harmless for any liability
174+ incurred by, or claims asserted against, such Contributor by reason
175+ of your accepting any such warranty or additional liability.
176+ 
177+ END OF TERMS AND CONDITIONS
178+ 
179+ APPENDIX: How to apply the Apache License to your work.
180+ 
181+ To apply the Apache License to your work, attach the following
182+ boilerplate notice, with the fields enclosed by brackets "[]"
183+ replaced with your own identifying information. (Don't include
184+ the brackets!) The text should be enclosed in the appropriate
185+ comment syntax for the file format. We also recommend that a
186+ file or class name and description of purpose be included on the
187+ same "printed page" as the copyright notice for easier
188+ identification within third-party archives.
189+ 
190+ Copyright [yyyy] [name of copyright owner]
191+ 
192+ Licensed under the Apache License, Version 2.0 (the "License");
193+ you may not use this file except in compliance with the License.
194+ You may obtain a copy of the License at
195+ 
196+ http://www.apache.org/licenses/LICENSE-2.0
197+ 
198+ Unless required by applicable law or agreed to in writing, software
199+ distributed under the License is distributed on an "AS IS" BASIS,
200+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201+ See the License for the specific language governing permissions and
202+ limitations under the License.
MREADME.md+5-3
@@ -1,7 +1,7 @@
1# cann-recipes-train1# cann-recipes-train
2 2 
3## 🚀Latest News3## 🚀Latest News
4-- [2025/09] DeepSeek-R1、Qwen2.5模型样例首次上线。4+- [2025/10] DeepSeek-R1、Qwen2.5模型样例首次上线。
5 5 
6## 🎉概述6## 🎉概述
7cann-recipes-train仓库旨在针对LLM与多模态模型训练业务中的典型模型、算法,提供基于CANN平台的优化样例,方便开发者简单、快速、高效地使用CANN平台进行模型训练。7cann-recipes-train仓库旨在针对LLM与多模态模型训练业务中的典型模型、算法,提供基于CANN平台的优化样例,方便开发者简单、快速、高效地使用CANN平台进行模型训练。
@@ -11,7 +11,7 @@ cann-recipes-train仓库旨在针对LLM与多模态模型训练业务中的典
11 11 
12|实践|简介|12|实践|简介|
13|-----|-----|13|-----|-----|
14-|[DeepSeek-V3 RL训练优化](rl_train/deepseek/README.md) |基于开源veRL框架,搭配MindSpeed+vLLM-Ascend框架,在Atlas A3集群实现GRPO算法的高吞吐RL训练,并达到120TPS/卡的系统吞吐量。|14+|[DeepSeek-R1 RL训练优化样例](rl_train/deepseek/README.md) |基于开源veRL框架,搭配MindSpeed+vLLM-Ascend框架,在Atlas A3集群实现GRPO算法的高吞吐RL训练,并达到120TPS/卡的系统吞吐量。|
15|[基于verl框架的Qwen2.5强化学习(入门样例)](rl_train/qwen2_5/verl_npu_demo/README.md) |基于Qwen2.5-1.5B-Instruct模型,采用verl强化学习框架,在MATH-lighteval数学推理数据集上进行了训练。本样例只需要单卡Atlas A2环境,帮助大家快速上手,使用昇腾NPU完成RL训练任务。|15|[基于verl框架的Qwen2.5强化学习(入门样例)](rl_train/qwen2_5/verl_npu_demo/README.md) |基于Qwen2.5-1.5B-Instruct模型,采用verl强化学习框架,在MATH-lighteval数学推理数据集上进行了训练。本样例只需要单卡Atlas A2环境,帮助大家快速上手,使用昇腾NPU完成RL训练任务。|
16 16 
17## 📖目录结构说明17## 📖目录结构说明
@@ -31,5 +31,7 @@ cann-recipes-train仓库旨在针对LLM与多模态模型训练业务中的典
31## 📝相关信息31## 📝相关信息
32 32 
33- [贡献指南](./CONTRIBUTION.md)33- [贡献指南](./CONTRIBUTION.md)
34-- [许可证](./LICENSE)34+- [许可证]
35+ 
36+cann-recipes-train仓涉及的模型,如模型目录下存在License的,以该License为准。如模型目录下不存在License的,遵循Apache 2.0许可证,对应许可证文本可查阅[LICENSE](./LICENSE)
35- [免责声明](DISCLAIMER.md)37- [免责声明](DISCLAIMER.md)
Mdocs/deepseek_rl_train_optimization.md+3-3
@@ -4,7 +4,7 @@
4 4 
5### 1.1 背景5### 1.1 背景
6 6 
7-DeepSeek-R1发布后,大模型的RL训练得到了广泛的关注,各大厂商以及开源社区都进行了大量的RL训练实践,致力于构建更高效的RL训练系统。本文基于开源的verl框架,搭配MindSpeed与vllm-ascend框架,经过深入优化与适配,在Atlas 900 A3 SuperPoD超节点上实现了高吞吐性能。7+DeepSeek-R1发布后,大模型的RL训练得到了广泛的关注,各大厂商以及开源社区都进行了大量的RL训练实践,致力于构建更高效的RL训练系统。本文基于开源的verl框架,搭配MindSpeed与vllm-ascend框架,经过深入优化与适配,在Atlas A3 SuperPoD超节点上实现了高吞吐性能。
8 8 
9本文中涉及的开源框架如下表所示。9本文中涉及的开源框架如下表所示。
10 10 
@@ -47,7 +47,7 @@ vLLM Ascend通过硬件插件化机制解耦了框架与硬件依赖,用户无
47 47 
48### 1.4 详细性能结果48### 1.4 详细性能结果
49 49 
50-基于Atlas 900 A3 SuperPoD超节点128卡集群,本实践在加载真实权重和随机初始化权重的两个场景中分别达成了如下性能效果:50+基于Atlas A3 SuperPoD超节点128卡集群,本实践在加载真实权重和随机初始化权重的两个场景中分别达成了如下性能效果:
51 51 
52#### 1.4.1 加载真实权重52#### 1.4.1 加载真实权重
53 53 
@@ -782,4 +782,4 @@ DeepSeek-V3网络的多路由专家计算由GroupedMatmul算子实现,该算
782 782 
783 783 
784[^1]: 此处使能的特性包含本文[5.1](###5.1 复用MindSpeed训练优化)、[6.1](###6.1 TorchAir整图下沉)、[6.2](###6.2 MoE/MLA多流)、[6.4](###6.4 KVCache支持NZ)、[6.5](###6.5 大EP的冗余算子消除),相关代码参见[verl](https://github.com/volcengine/verl/pull/3427)与[vLLM-Ascend](https://github.com/vllm-project/vllm-ascend/tree/v0.9.1rc2)。784[^1]: 此处使能的特性包含本文[5.1](###5.1 复用MindSpeed训练优化)、[6.1](###6.1 TorchAir整图下沉)、[6.2](###6.2 MoE/MLA多流)、[6.4](###6.4 KVCache支持NZ)、[6.5](###6.5 大EP的冗余算子消除),相关代码参见[verl](https://github.com/volcengine/verl/pull/3427)与[vLLM-Ascend](https://github.com/vllm-project/vllm-ascend/tree/v0.9.1rc2)。
785-[^2]: 此处使能了本文3~6章节所描述的所有优化特性,其中推理优化已合入vLLM-Ascend主线,其他优化可以参考[GitCode](https://gitcode.com/cann/cann-recipes-train/blob/master/rl_train/deepseek/README.md)仓库开源的RL训练recipe代码。785+[^2]: 此处使能了本文3~6章节所描述的所有优化特性,其中推理优化已合入vLLM-Ascend主线,其他优化可以参考[GitCode](https://gitcode.com/cann/cann-recipes-train/blob/master/rl_train/deepseek/README.md)仓库开源的RL训练recipe代码。
Mrl_train/deepseek/README.md+3-3
@@ -1,10 +1,10 @@
1-# DeepSeek-V3 RL训练优化实践样例1+# DeepSeek-R1 RL训练优化实践样例
2 2 
3## 概述3## 概述
4 4 
5-本样例针对DeepSeek-V3模型,基于[verl开源框架](https://github.com/volcengine/verl),配合MindSpeed-LLM和vLLM-Ascend框架,完成RL训练全流程的优化适配。优化点介绍可参见[基于veRL前端&A3集群的DeepSeekR1模型RL训练优化实践](../../docs/deepseek_rl_train_optimization.md)。5+本样例针对DeepSeek-R1模型,基于[verl开源框架](https://github.com/volcengine/verl),配合MindSpeed-LLM和vLLM-Ascend框架,完成RL训练全流程的优化适配。优化点介绍可参见[基于veRL前端&A3集群的DeepSeekR1模型RL训练优化实践](../../docs/deepseek_rl_train_optimization.md)。
6 6 
7-本样例基于Atlas 900 A3 128卡集群,加载真实权重,使用deepscaler数据集,Prefill/Decode阶段长度分别为1K与3K,系统吞吐可达到120TPS/卡。随着训练的进行,模型response_length会有所增长,系统吞吐可以进一步提升。7+本样例基于Atlas A3 128卡集群,加载真实权重,使用deepscaler数据集,Prefill/Decode阶段长度分别为1K与3K,系统吞吐可达到120TPS/卡。随着训练的进行,模型response_length会有所增长,系统吞吐可以进一步提升。
8| 基础模型 | 机器型号 | GBS | n_samples | step | max_prompt_length | max_response_length | 端到端TPS |8| 基础模型 | 机器型号 | GBS | n_samples | step | max_prompt_length | max_response_length | 端到端TPS |
9|---------------------|----------|-----|-----------|--------- | ----------|------------|---------|9|---------------------|----------|-----|-----------|--------- | ----------|------------|---------|
10| DeepSeek-V3-671B | Atlas A3 128卡 | 512 | 16 | 2 | 1024 | 3072 | 120 |10| DeepSeek-V3-671B | Atlas A3 128卡 | 512 | 16 | 2 | 1024 | 3072 | 120 |
Mrl_train/deepseek/megatron_patches/core/packed_seq_params.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/NVIDIA/Megatron-LM/blob/core_r0.8.0/megatron/core/packed_seq_params.py2# https://github.com/NVIDIA/Megatron-LM/blob/core_r0.8.0/megatron/core/packed_seq_params.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.4# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/megatron_patches/core/tensor_parallel/cross_entropy.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/NVIDIA/Megatron-LM/blob/core_r0.8.0/megatron/core/tensor_parallel/cross_entropy.py2# https://github.com/NVIDIA/Megatron-LM/blob/core_r0.8.0/megatron/core/tensor_parallel/cross_entropy.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.4# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/run_container.sh+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9#!/bin/bash15#!/bin/bash
10container_name=$116container_name=$1
Mrl_train/deepseek/verl_patches/features/rollout_optimize/config.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import dataclasses15import dataclasses
10 16 
Mrl_train/deepseek/verl_patches/features/rollout_optimize/rollout_rebalance.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import datetime15import datetime
10import pickle16import pickle
Mrl_train/deepseek/verl_patches/features/rollout_optimize/utils.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import functools15import functools
10import torch16import torch
Mrl_train/deepseek/verl_patches/models/mcore/config_converter.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/config_converter.py2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/config_converter.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/models/mcore/model_forward.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/models/mcore/model_forward.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/models/mcore/model_forward.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2025 Bytedance Ltd. and/or its affiliates4# Copyright 2025 Bytedance Ltd. and/or its affiliates
5# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.5# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
6# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.6# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Mrl_train/deepseek/verl_patches/models/mcore/model_initializer.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/model_initializer.py2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/model_initializer.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/models/mcore/util.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/util.py2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/util.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2025 Bytedance Ltd. and/or its affiliates4# Copyright 2025 Bytedance Ltd. and/or its affiliates
5# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.5# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
6#6#
Mrl_train/deepseek/verl_patches/models/mcore/weight_converter.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/weight_converter.py2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/weight_converter.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/models/mcore/weight_loader_registry.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/weight_loader_registry.py2# https://github.com/volcengine/verl/blob/main/verl/models/mcore/weight_loader_registry.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/prelude_patch.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import sys15import sys
10import importlib16import importlib
Mrl_train/deepseek/verl_patches/profiler.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import os15import os
10import logging16import logging
Mrl_train/deepseek/verl_patches/protocol.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/protocol.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/protocol.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/scripts/fp8_cast_bf16.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/fp8_cast_bf16.py2# https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/fp8_cast_bf16.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright (c) 2023 DeepSeek4# Copyright (c) 2023 DeepSeek
5 5 
6import os6import os
Mrl_train/deepseek/verl_patches/scripts/internal/train_grpo_deepseekv3_256die_random_init.sh+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_deepseek671b_math_megatron_96gb.sh2# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_deepseek671b_math_megatron_96gb.sh
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/scripts/internal/train_grpo_deepseekv3_256die_true_weight.sh+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_deepseek671b_math_megatron_96gb.sh2# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_deepseek671b_math_megatron_96gb.sh
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/scripts/json_to_parquet.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import os15import os
10import json16import json
Mrl_train/deepseek/verl_patches/scripts/train_deepseekv3_256die_random_init.sh+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9pkill -9 python15pkill -9 python
10ray stop --force16ray stop --force
Mrl_train/deepseek/verl_patches/scripts/train_deepseekv3_256die_true_weight.sh+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9pkill -9 python15pkill -9 python
10ray stop --force16ray stop --force
Mrl_train/deepseek/verl_patches/single_controller/base/megatron/worker.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/single_controller/base/megatron/worker.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/single_controller/base/megatron/worker.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/single_controller/decorator.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/single_controller/base/decorator.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/single_controller/base/decorator.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/tensor_cache.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9from typing import Optional, List15from typing import Optional, List
10import torch16import torch
Mrl_train/deepseek/verl_patches/tools.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import os15import os
10import logging16import logging
Mrl_train/deepseek/verl_patches/trainer/config/ppo_mindspeed_trainer.yaml+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9data:15data:
10 tokenizer: null16 tokenizer: null
Mrl_train/deepseek/verl_patches/trainer/main_ppo_npu.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.2.0.post1/verl/trainer/main_ppo.py2# https://github.com/volcengine/verl/blob/v0.2.0.post1/verl/trainer/main_ppo.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/trainer/ppo/ray_trainer.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.2.0.post1/verl/trainer/ppo/ray_trainer.py2# https://github.com/volcengine/verl/blob/v0.2.0.post1/verl/trainer/ppo/ray_trainer.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/trainer/verl_trainer_adaptor.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9from verl.trainer.ppo import ray_trainer15from verl.trainer.ppo import ray_trainer
10from verl.trainer.ppo.ray_trainer import RayPPOTrainer16from verl.trainer.ppo.ray_trainer import RayPPOTrainer
Mrl_train/deepseek/verl_patches/utils/megatron/tensor_parallel.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/megatron/tensor_parallel.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/megatron/tensor_parallel.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/utils/megatron_utils.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/megatron_utils.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/megatron_utils.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/utils/model.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/model.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/model.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/utils/reshard.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9from typing import List15from typing import List
10import torch16import torch
Mrl_train/deepseek/verl_patches/utils/reward/__init__.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/reward_score/__init__.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/utils/reward_score/__init__.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/utils/reward/deepscaler.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9from mathruler.grader import extract_boxed_content15from mathruler.grader import extract_boxed_content
10 16 
Mrl_train/deepseek/verl_patches/verl_adaptor.py+13-7
@@ -1,10 +1,16 @@
1-# This program is free software, you can redistribute it and/or modify it.1+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+#
3-# This file is a part of the CANN Open Software.3+# Licensed under the Apache License, Version 2.0 (the "License");
4-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").4+# you may not use this file except in compliance with the License.
5-# Please refer to the License for details. You may not use this file except in compliance with the License.5+# You may obtain a copy of the License at
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.6+#
7-# See LICENSE in the root of the software repository for the full text of the License.7+# http://www.apache.org/licenses/LICENSE-2.0
8+#
9+# Unless required by applicable law or agreed to in writing, software
10+# distributed under the License is distributed on an "AS IS" BASIS,
11+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+# See the License for the specific language governing permissions and
13+# limitations under the License.
8 14 
9import sys15import sys
10 16 
Mrl_train/deepseek/verl_patches/workers/actor/megatron_actor.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/actor/megatron_actor.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/actor/megatron_actor.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/workers/megatron_workers.py+1-1
@@ -1,7 +1,7 @@
1# coding=utf-81# coding=utf-8
2# Adapted from2# Adapted from
3# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/megatron_workers.py3# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/megatron_workers.py
4-# Copyright (c) 2025 Huawei Technologies Co., Ltd.4+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
5# Copyright 2024 Bytedance Ltd. and/or its affiliates5# Copyright 2024 Bytedance Ltd. and/or its affiliates
6#6#
7# Licensed under the Apache License, Version 2.0 (the "License");7# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/workers/sharding_manager/megatron_vllm.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/sharding_manager/megatron_vllm.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/sharding_manager/megatron_vllm.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/workers/vllm_rollout/engine_core.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/vllm-project/vllm/blob/main/vllm/v1/engine/core.py2# https://github.com/vllm-project/vllm/blob/main/vllm/v1/engine/core.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# SPDX-License-Identifier: Apache-2.04# SPDX-License-Identifier: Apache-2.0
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/deepseek/verl_patches/workers/vllm_rollout/vllm_rollout_spmd.py+1-1
@@ -1,6 +1,6 @@
1# Adapted from1# Adapted from
2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/rollout/vllm_rollout/vllm_rollout_spmd.py2# https://github.com/volcengine/verl/blob/v0.4.0/verl/workers/rollout/vllm_rollout/vllm_rollout_spmd.py
3-# Copyright (c) 2025 Huawei Technologies Co., Ltd.3+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
4# Copyright 2024 Bytedance Ltd. and/or its affiliates4# Copyright 2024 Bytedance Ltd. and/or its affiliates
5#5#
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
Mrl_train/qwen2_5/verl_npu_demo/new_math_reward.py+1-1
@@ -5,7 +5,7 @@
5# https://github.com/EleutherAI/lm-evaluation-harness/blob/main/lm_eval/tasks/hendrycks_math/utils.py5# https://github.com/EleutherAI/lm-evaluation-harness/blob/main/lm_eval/tasks/hendrycks_math/utils.py
6# Additional references are made to OpenCompass Authors' work at:6# Additional references are made to OpenCompass Authors' work at:
7# https://github.com/open-compass/opencompass/blob/main/opencompass/evaluator/math_evaluator.py7# https://github.com/open-compass/opencompass/blob/main/opencompass/evaluator/math_evaluator.py
8-# Copyright (c) 2025 Huawei Technologies Co., Ltd.8+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
9# Copyright 2024 Bytedance Ltd. and/or its affiliates. All rights reserved.9# Copyright 2024 Bytedance Ltd. and/or its affiliates. All rights reserved.
10# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.10# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
11# Copyright 2020 OpenCompass Authors. All rights reserved.11# Copyright 2020 OpenCompass Authors. All rights reserved.
Mrl_train/qwen2_5/verl_npu_demo/parquet2json.py+1-1
@@ -1,5 +1,5 @@
1# coding=utf-81# coding=utf-8
2-# Copyright (c) 2025 Huawei Technologies Co., Ltd.2+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").3# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").
4# Please refer to the License for details. You may not use this file except in compliance with the License.4# Please refer to the License for details. You may not use this file except in compliance with the License.
5# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,5# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
Mrl_train/qwen2_5/verl_npu_demo/run_qwen2_5_1_5b.sh+1-1
@@ -1,7 +1,7 @@
1# coding=utf-81# coding=utf-8
2# Adapted from2# Adapted from
3# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_qwen2_5_7b_grpo_npu.sh3# https://github.com/volcengine/verl/blob/main/examples/grpo_trainer/run_qwen2_5_7b_grpo_npu.sh
4-# Copyright (c) 2025 Huawei Technologies Co., Ltd.4+# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
5# Copyright 2024 Bytedance Ltd. and/or its affiliates. All rights reserved.5# Copyright 2024 Bytedance Ltd. and/or its affiliates. All rights reserved.
6# Licensed under the Apache License, Version 2.0 (the "License");6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.7# you may not use this file except in compliance with the License.