Skip to content

Commit a4712fc

Browse files
committed
update docker install guide
1 parent ded6d23 commit a4712fc

File tree

3 files changed

+82
-26
lines changed

3 files changed

+82
-26
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.

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+
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+
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

0 commit comments

Comments
 (0)