Skip to content

Commit 5e281a4

Browse files
committed
Merge branch 'main' of github.com:modelscope/Trinity-RFT into upd/verl_0.7.0
2 parents e094c99 + 34c0eab commit 5e281a4

File tree

26 files changed

+495
-215
lines changed

26 files changed

+495
-215
lines changed

.github/workflows/docker.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ jobs:
4949
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5050
tags: |
5151
type=match,pattern=\d.\d.\d,enable=${{ github.event_name == 'release' }}
52-
type=sha,enable=${{ github.event_name == 'release' }}
5352
type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
54-
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
5553
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
5654
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
5755
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.

README.md

Lines changed: 89 additions & 106 deletions
Large diffs are not rendered by default.

README_zh.md

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,28 @@ git clone https://github.com/modelscope/Trinity-RFT
181181
cd Trinity-RFT
182182
```
183183

184-
### 2. 创建虚拟环境
184+
### 2. 构建环境
185185

186186
可选择以下任一方式:
187187

188+
#### 使用预构建 Docker 镜像(推荐初学者使用该方法)
189+
190+
191+
```bash
192+
docker pull ghcr.io/modelscope/trinity-rft:latest
193+
194+
# 将 <path_to_your_data_and_checkpoints> 替换为实际需要挂载的路径
195+
docker run -it \
196+
--gpus all \
197+
--shm-size="64g" \
198+
--rm \
199+
-v $PWD:/workspace \
200+
-v <path_to_your_data_and_checkpoints>:/data \
201+
ghcr.io/modelscope/trinity-rft:latest
202+
```
203+
204+
> 该镜像已经通过 `uv` 安装了 Trinity-RFT 以及所有 GPU 相关依赖,且会自动激活虚拟环境(也可通过 `source /opt/venv/bin/activate` 手动激活)。必要时可使用 `uv pip install` 添加额外的包。
205+
188206
#### 使用 Conda
189207

190208
```bash
@@ -246,28 +264,6 @@ uv pip install trinity-rft
246264
uv pip install flash-attn==2.8.1
247265
```
248266

249-
## 使用 Docker
250-
251-
我们提供了 Docker 环境,方便快速配置。
252-
253-
```bash
254-
git clone https://github.com/modelscope/Trinity-RFT
255-
cd Trinity-RFT
256-
257-
# 构建 Docker 镜像
258-
## 提示:可根据需要修改 Dockerfile 添加镜像源或设置 API 密钥
259-
docker build -f scripts/docker/Dockerfile -t trinity-rft:latest .
260-
261-
# 运行容器,请将 <path_to_your_data_and_checkpoints> 替换为实际需要挂载的路径
262-
docker run -it \
263-
--gpus all \
264-
--shm-size="64g" \
265-
--rm \
266-
-v $PWD:/workspace \
267-
-v <path_to_your_data_and_checkpoints>:/data \
268-
trinity-rft:latest
269-
```
270-
271267
> 如需使用 **Megatron-LM** 进行训练,请参考 [Megatron-LM 支持](https://modelscope.github.io/Trinity-RFT/zh/main/tutorial/example_megatron.html)
272268
273269

@@ -338,8 +334,6 @@ trinity studio --port 8080
338334
</details>
339335

340336

341-
342-
343337
### 第四步:运行 RFT 流程
344338

345339

docs/sphinx_doc/source/tutorial/trinity_installation.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
(Installation)=
22
# Installation
33

4-
For installing Trinity-RFT, you have three options: from source (recommended), via PyPI, or using Docker.
4+
For installing Trinity-RFT, you have three options: from source (recommended for experienced users), using Docker (recommended for beginners) or via PyPI.
55

66
**Before you begin**, check your system setup:
77

8-
### If you have GPUs and want to use them:
8+
### If you have GPUs and want to use them
9+
910
Make sure your system meets these requirements:
11+
1012
- **Python**: 3.10 – 3.12
1113
- **CUDA**: 12.8 or higher
1214
- **GPUs**: At least 2 available
1315

14-
### If you don’t have GPUs (or prefer not to use them):
16+
### If you don’t have GPUs or prefer not to use them
17+
1518
You can use the `tinker` option instead, which only requires:
19+
1620
- **Python**: 3.11 – 3.12
1721
- **GPUs**: Not required
1822

1923
---
2024

21-
## From Source (Recommended)
25+
## From Source (Recommended for experienced users)
2226

2327
This method is best if you plan to customize or contribute to Trinity-RFT.
2428

@@ -100,7 +104,31 @@ uv pip install flash-attn==2.8.1
100104

101105
## Using Docker
102106

103-
We provide a Docker setup for hassle-free environment configuration.
107+
You can download the Trinity-RFT Docker image from Github Container Registry or build it locally.
108+
109+
### Pull from GitHub Container Registry (Recommended for beginners)
110+
111+
```bash
112+
git clone https://github.com/modelscope/Trinity-RFT
113+
cd Trinity-RFT
114+
115+
docker pull ghcr.io/modelscope/trinity-rft:latest
116+
117+
docker run -it \
118+
--gpus all \
119+
--shm-size="64g" \
120+
--rm \
121+
-v $PWD:/workspace \
122+
-v <path_to_your_data_and_checkpoints>:/data \
123+
ghcr.io/modelscope/trinity-rft:latest
124+
```
125+
126+
```{note}
127+
This docker image use `uv` to manage python packages, you need to activate the virtual environment using `source /opt/venv/bin/activate` after entering the docker container.
128+
The image has include dependencies such as vllm, flash-attn and Megatron-LM, if you need to download more packages, don't forget to activate the virtual environment and use `uv pip install` to install them.
129+
```
130+
131+
### Build Locally
104132

105133
```bash
106134
git clone https://github.com/modelscope/Trinity-RFT
@@ -120,12 +148,12 @@ docker run -it \
120148
trinity-rft:latest
121149
```
122150

151+
---
152+
123153
```{note}
124154
For training with **Megatron-LM**, please refer to {ref}`Megatron-LM Backend <Megatron-LM>`.
125155
```
126156

127-
---
128-
129157
## Troubleshooting
130158

131159
If you encounter installation issues, refer to the FAQ or [GitHub Issues](https://github.com/modelscope/Trinity-RFT/issues).

docs/sphinx_doc/source_zh/tutorial/trinity_installation.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
(Installation)=
22
# 安装指南
33

4-
安装 Trinity-RFT 有三种方式:源码安装(推荐)、通过 PyPI 安装,或使用 Docker
4+
安装 Trinity-RFT 有三种方式:源码安装(推荐有经验的用户使用该方法)、使用 Docker (推荐初学者使用该方法) 或是从 PyPI 安装。
55

66
**开始之前**,请检查您的系统配置:
77

8-
### 如果您拥有 GPU 并希望使用它们:
8+
### 如果您有 GPU 并希望使用它们
9+
910
请确保您的系统满足以下要求:
11+
1012
- **Python**:3.10 – 3.12
1113
- **CUDA**:12.8 或更高版本
1214
- **GPU**:至少 2 块可用
1315

14-
### 如果您没有 GPU(或不希望使用 GPU):
16+
### 如果您没有 GPU 或不希望使用 GPU
17+
1518
您可以改用 `tinker` 选项,该选项仅需满足:
19+
1620
- **Python**:3.11 – 3.12
1721
- **GPU**:无需
1822

1923
---
2024

21-
## 源码安装(推荐
25+
## 源码安装(推荐有经验的用户使用该方法
2226

2327
如需修改、扩展 Trinity-RFT,推荐使用此方法。
2428

@@ -80,27 +84,34 @@ uv sync --extra vllm --extra dev --extra flash_attn
8084

8185
---
8286

83-
## 通过 PyPI 安装
87+
## 使用 Docker
8488

85-
如果您只需使用 Trinity-RFT 而不打算修改代码:
89+
您可以从 Github 拉取 Docker 镜像或是自行构建镜像。
90+
91+
### 从 Github 拉取预构建镜像 (推荐初学者使用该方法)
8692

8793
```bash
88-
pip install trinity-rft
89-
pip install flash-attn==2.8.1
90-
```
94+
git clone https://github.com/modelscope/Trinity-RFT
95+
cd Trinity-RFT
9196

92-
或使用 `uv`
97+
docker pull ghcr.io/modelscope/trinity-rft:latest
9398

94-
```bash
95-
uv pip install trinity-rft
96-
uv pip install flash-attn==2.8.1
99+
docker run -it \
100+
--gpus all \
101+
--shm-size="64g" \
102+
--rm \
103+
-v $PWD:/workspace \
104+
-v <path_to_your_data_and_checkpoints>:/data \
105+
ghcr.io/modelscope/trinity-rft:latest
97106
```
98107

99-
---
108+
```{note}
109+
该 Docker 镜像使用 `uv` 来管理 Python 依赖,进入容器后虚拟环境会自动激活(也可通过 `source /opt/venv/bin/activate` 手动激活)。
110+
该镜像已经包含了 vllm, flash-attn 以及 Megatron-LM,如果需要使用其他依赖,可直接使用 `uv pip install` 来安装它们。
111+
```
100112

101-
## 使用 Docker
113+
### 自行构建 Docker 镜像
102114

103-
我们提供了 Docker 环境,方便快速配置。
104115

105116
```bash
106117
git clone https://github.com/modelscope/Trinity-RFT
@@ -120,11 +131,30 @@ docker run -it \
120131
trinity-rft:latest
121132
```
122133

134+
---
135+
136+
## 通过 PyPI 安装
137+
138+
如果您只需使用 Trinity-RFT 而不打算修改代码:
139+
140+
```bash
141+
pip install trinity-rft
142+
pip install flash-attn==2.8.1
143+
```
144+
145+
或使用 `uv`
146+
147+
```bash
148+
uv pip install trinity-rft
149+
uv pip install flash-attn==2.8.1
150+
```
151+
152+
---
153+
123154
```{note}
124155
如需使用 **Megatron-LM** 进行训练,请参考 {ref}`Megatron-LM Backend <Megatron-LM>`。
125156
```
126157

127-
---
128158

129159
## 常见问题
130160

scripts/context_length_test/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Below are empirical results from running this script on various Qwen3 models acr
124124

125125
### A100 80GB
126126

127-
#### Vallina Settings (Baseline)
127+
#### Vanilla Settings (Baseline)
128128

129129
| #GPU | SP | Qwen3-0.6B | Qwen3-1.7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |
130130
| ---- | -- | ---------- | ---------- | -------- | -------- | --------- |
@@ -177,7 +177,7 @@ Below are empirical results from running this script on various Qwen3 models acr
177177
### H20 96GB (Higher VRAM, Slower Bandwidth)
178178

179179

180-
#### Vallina Settings
180+
#### Vanilla Settings
181181

182182

183183
| #GPU | SP | Qwen3-0.6B | Qwen3-1.7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |

0 commit comments

Comments
 (0)