Skip to content

Commit baa1c3f

Browse files
authored
Install from Dockerfile (#7)
1 parent f612679 commit baa1c3f

File tree

5 files changed

+85
-29
lines changed

5 files changed

+85
-29
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,30 @@ source .venv/bin/activate
123123
pip install -e .[dev]
124124
# for zsh
125125
pip install -e .\[dev\]
126+
127+
# Install flash-attn after all dependencies are installed
128+
# Note: flash-attn will take a long time to compile, please be patient.
129+
pip install flash-attn -v
130+
# Try the following command if you encounter errors during installation
131+
# pip install flash-attn -v --no-build-isolation
126132
```
127133

134+
Installation from docker:
128135

136+
We provided a dockerfile for Trinity-RFT (trinity)
129137

130-
Installation with pip:
131-
(coming soon)
138+
```shell
139+
git clone https://github.com/modelscope/Trinity-RFT
140+
cd Trinity-RFT
132141

142+
# build the docker image
143+
# Note: you can edit the dockerfile to customize the environment
144+
# e.g., use pip mirrors or set api key
145+
docker build -f scripts/docker/Dockerfile -t trinity-rft:latest .
146+
147+
# run the docker image
148+
docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data trinity-rft:latest
149+
```
133150

134151

135152
### Step 2: prepare dataset and model
@@ -263,18 +280,6 @@ Please refer to [this document](./docs/sphinx_doc/source/tutorial/trinity_progra
263280
This project is currently under active development, and we welcome contributions from the community!
264281

265282

266-
267-
Installation for development:
268-
269-
```shell
270-
# for bash
271-
pip install -e .[dev]
272-
# for zsh
273-
pip install -e .\[dev\]
274-
```
275-
276-
277-
278283
Code style check:
279284

280285
```shell

docs/sphinx_doc/source/main.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,31 @@ source .venv/bin/activate
115115
pip install -e .[dev]
116116
# for zsh
117117
pip install -e .\[dev\]
118+
119+
# Install flash-attn after all dependencies are installed
120+
# Note: flash-attn will take a long time to compile, please be patient.
121+
pip install flash-attn -v
122+
# Try the following command if you encounter errors during installation
123+
# pip install flash-attn -v --no-build-isolation
118124
```
119125

120126

127+
Installation from docker:
128+
129+
We provided a dockerfile for Trinity-RFT (trinity)
130+
131+
```shell
132+
git clone https://github.com/modelscope/Trinity-RFT
133+
cd Trinity-RFT
134+
135+
# build the docker image
136+
# Note: you can edit the dockerfile to customize the environment
137+
# e.g., use pip mirrors or set api key
138+
docker build -f scripts/docker/Dockerfile -t trinity-rft:latest .
121139

122-
Installation with pip:
123-
(coming soon)
140+
# run the docker image
141+
docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data trinity-rft:latest
142+
```
124143

125144

126145

@@ -255,18 +274,6 @@ Please refer to [this document](tutorial/trinity_programming_guide.md).
255274
This project is currently under active development, and we welcome contributions from the community!
256275

257276

258-
259-
Installation for development:
260-
261-
```shell
262-
# for bash
263-
pip install -e .[dev]
264-
# for zsh
265-
pip install -e .\[dev\]
266-
```
267-
268-
269-
270277
Code style check:
271278

272279
```shell

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies = [
2323
"ray==2.43.0",
2424
"vllm==0.8.3",
2525
"tensordict==0.6.2",
26-
"redis",
2726
"wandb",
2827
"omegaconf",
2928
"sqlalchemy",

scripts/docker/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Build and run the docker image with the following command:
2+
#
3+
# cd <Trinity-RFT root dir>
4+
# docker build -f scripts/docker/Dockerfile -t trinity-rft:latest .
5+
# docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data trinity-rft:latest
6+
7+
8+
FROM nvcr.io/nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
9+
10+
WORKDIR /workspace
11+
12+
RUN apt update && apt install -y \
13+
build-essential \
14+
curl \
15+
git \
16+
wget \
17+
vim \
18+
tmux \
19+
python3 \
20+
python3-pip \
21+
python3-dev \
22+
python3-packaging \
23+
&& rm -rf /var/lib/apt/lists/* \
24+
&& ln -sf /usr/bin/python3 /usr/bin/python
25+
26+
27+
# For Aliyun users: update pip mirror to aliyun to speed up pip install
28+
RUN pip config set global.index-url http://mirrors.cloud.aliyuncs.com/pypi/simple/ \
29+
&& pip config set global.trusted-host mirrors.cloud.aliyuncs.com
30+
31+
# copy the Trinity-RFT dir into the workspace
32+
COPY . .
33+
34+
RUN pip install --upgrade pip && pip install -e .[dev] && pip install flash-attn
35+
36+
# Set Env variables
37+
38+
# WANDB
39+
# ENV WANDB_API_KEY=
40+
# ENV WANDB_BASE_URL=
41+
42+
# LLM API
43+
# ENV OPENAI_API_KEY=
44+
# ENV DASH_API_KEY=

trinity/common/verl_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def synchronize_config(self, config: Config) -> None:
268268
self.trainer.nnodes = config.cluster.node_num - rollout_node_num
269269
self.actor_rollout_ref.model.path = config.model.model_path
270270
self.critic.model.path = config.model.critic_model_path
271+
self.critic.model.tokenizer_path = config.model.critic_model_path
271272

272273
if config.cluster.node_num == 1:
273274
# for single node scenarios, rollout and training are on the same node

0 commit comments

Comments
 (0)