Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=\d.\d.\d,enable=${{ github.event_name == 'release' }}
type=sha,enable=${{ github.event_name == 'release' }}
type=raw,value=${{ github.event.inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
# 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.
# 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.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
Expand Down
42 changes: 35 additions & 7 deletions docs/sphinx_doc/source/tutorial/trinity_installation.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
(Installation)=
# Installation

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

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

### If you have GPUs and want to use them:
### If you have GPUs and want to use them

Make sure your system meets these requirements:

- **Python**: 3.10 – 3.12
- **CUDA**: 12.8 or higher
- **GPUs**: At least 2 available

### If you don’t have GPUs (or prefer not to use them):
### If you don’t have GPUs or prefer not to use them

You can use the `tinker` option instead, which only requires:

- **Python**: 3.11 – 3.12
- **GPUs**: Not required

---

## From Source (Recommended)
## From Source (Recommended for experienced users)

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

Expand Down Expand Up @@ -100,7 +104,31 @@ uv pip install flash-attn==2.8.1

## Using Docker

We provide a Docker setup for hassle-free environment configuration.
You can download the Trinity-RFT Docker image from Github Container Registry or build it locally.

### Pull from GitHub Container Registry (Recommended for beginners)

```bash
git clone https://github.com/modelscope/Trinity-RFT
cd Trinity-RFT

docker pull ghcr.io/modelscope/trinity-rft:latest

docker run -it \
--gpus all \
--shm-size="64g" \
--rm \
-v $PWD:/workspace \
-v <path_to_your_data_and_checkpoints>:/data \
trinity-rft:latest
```

```{note}
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.
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.
```

### Build Locally

```bash
git clone https://github.com/modelscope/Trinity-RFT
Expand All @@ -120,12 +148,12 @@ docker run -it \
trinity-rft:latest
```

---

```{note}
For training with **Megatron-LM**, please refer to {ref}`Megatron-LM Backend <Megatron-LM>`.
```

---

## Troubleshooting

If you encounter installation issues, refer to the FAQ or [GitHub Issues](https://github.com/modelscope/Trinity-RFT/issues).
64 changes: 47 additions & 17 deletions docs/sphinx_doc/source_zh/tutorial/trinity_installation.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
(Installation)=
# 安装指南

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

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

### 如果您拥有 GPU 并希望使用它们:
### 如果您有 GPU 并希望使用它们

请确保您的系统满足以下要求:

- **Python**:3.10 – 3.12
- **CUDA**:12.8 或更高版本
- **GPU**:至少 2 块可用

### 如果您没有 GPU(或不希望使用 GPU):
### 如果您没有 GPU 或不希望使用 GPU

您可以改用 `tinker` 选项,该选项仅需满足:

- **Python**:3.11 – 3.12
- **GPU**:无需

---

## 源码安装(推荐
## 源码安装(推荐有经验的用户使用该方法

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

Expand Down Expand Up @@ -80,27 +84,34 @@ uv sync --extra vllm --extra dev --extra flash_attn

---

## 通过 PyPI 安装
## 使用 Docker

如果您只需使用 Trinity-RFT 而不打算修改代码:
您可以从 Github 拉取 Docker 镜像或是自行构建镜像。

### 从 Github 拉取预构建镜像 (推荐初学者使用该方法)

```bash
pip install trinity-rft
pip install flash-attn==2.8.1
```
git clone https://github.com/modelscope/Trinity-RFT
cd Trinity-RFT

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

```bash
uv pip install trinity-rft
uv pip install flash-attn==2.8.1
docker run -it \
--gpus all \
--shm-size="64g" \
--rm \
-v $PWD:/workspace \
-v <path_to_your_data_and_checkpoints>:/data \
trinity-rft:latest
```

---
```{note}
该 Docker 镜像使用 `uv` 来管理 Python 依赖,您需要在进入容器后使用 `source /opt/venv/bin/activate` 激活虚拟环境。
该镜像已经包含了 vllm, flash-attn 以及 Megatron-LM,如果需要使用其他依赖,不要忘记在激活环境后使用 `uv pip install` 来安装它们。
```

## 使用 Docker
### 自行构建 Docker 镜像

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

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

---

## 通过 PyPI 安装

如果您只需使用 Trinity-RFT 而不打算修改代码:

```bash
pip install trinity-rft
pip install flash-attn==2.8.1
```

或使用 `uv`:

```bash
uv pip install trinity-rft
uv pip install flash-attn==2.8.1
```

---

```{note}
如需使用 **Megatron-LM** 进行训练,请参考 {ref}`Megatron-LM Backend <Megatron-LM>`。
```

---

## 常见问题

Expand Down