Skip to content

Commit ce82bec

Browse files
committed
update dockerfiles
1 parent 224560f commit ce82bec

5 files changed

Lines changed: 165 additions & 19 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ tutorial/example_deep_finance/yaml/*
158158
tutorial/example_deep_finance/config/*
159159
tutorial/example_deep_finance/scripts/*
160160
flash_attn-2.8.*.whl
161+
.dockerignore
162+
benchmark_datasets
163+
modelscope_cache

scripts/docker/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
0. test docker installation
2+
3+
```
4+
docker run --rm --gpus all nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04 nvidia-smi
5+
```
6+
7+
8+
1. Run `docker build -f scripts/docker/dockerfile -t ajet:latest .` to build docker container
9+
10+
2. By the way, for users in China, using the alternative dockerfile script `docker build -f scripts/docker/dockerfile_zh -t ajet:latest .` can optimize the download speed using alibaba public cloud.
11+
12+
3. To run build-in tests, please follow instructions to mount test models and datasets.
13+
- Download model manually, or use the helper script `python ./scripts/download_model.py`.
14+
- For example, if your model is in `./modelscope_cache/Qwen/Qwen2___5-14B-Instruct`.
15+
- and your dataset is in `benchmark_datasets/dataset`
16+
- run
17+
```
18+
docker run -it --gpus all --shm-size="64g" --rm \
19+
-v "$(pwd)/modelscope_cache/Qwen/Qwen2___5-14B-Instruct:/mnt/data_cpfs/model_cache/modelscope/hub/Qwen/Qwen/Qwen2___5-7B-Instruct" \
20+
-v "$(pwd)/benchmark_datasets/dataset:/mnt/data_cpfs/model_cache/modelscope/dataset" \
21+
-e VERL_PYTHON="./.venv/bin/python" \
22+
-e NCCL_NVLS_ENABLE=0 \
23+
ajet:latest \
24+
python -m pytest -s tests/bench/benchmark_math/execute_benchmark_math.py::TestBenchmarkMath::test_01_begin_verl
25+
```

scripts/docker/dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# docker build -f scripts/docker/dockerfile -t ajet:latest .
44
# docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data ajet:latest
55

6-
76
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
87

98
WORKDIR /workspace
@@ -25,8 +24,8 @@ RUN apt install -y \
2524
# set uv virtual environment path to a outside-of-workspace dir
2625
ENV VIRTUAL_ENV=/opt/venv
2726

28-
# copy the AgentJets dir into the workspace
29-
COPY pyproject.toml pyproject.toml
27+
# copy the AgentJets dir into the workspace (copy first to accelerate installation)
28+
COPY scripts/docker/pyproject_for_docker_build.toml pyproject.toml
3029

3130
# Install uv
3231
RUN pip install uv
@@ -36,19 +35,18 @@ RUN uv venv /opt/venv --python=3.10
3635

3736
ENV UV_HTTP_TIMEOUT=9999
3837

39-
40-
# RUN . /opt/venv/bin/activate && uv pip install -e .[verl] -i https://mirrors.aliyun.com/pypi/simple/
41-
# RUN . /opt/venv/bin/activate && uv pip install flash_attn==2.8.3 --no-deps --no-cache-dir --no-build-isolation
42-
43-
# for ZH users
44-
RUN . /opt/venv/bin/activate && uv pip install -e .[verl] -i https://mirrors.aliyun.com/pypi/simple/
45-
COPY flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
46-
RUN . /opt/venv/bin/activate && uv pip install flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
38+
RUN . /opt/venv/bin/activate && uv pip install -e .[verl]
39+
RUN . /opt/venv/bin/activate && uv pip install flash_attn==2.8.3 --no-deps --no-cache-dir --no-build-isolation
4740

4841

4942
# cache friendly layer for code changes
5043
COPY . .
5144

45+
5246
# set entrypoint to activate the virtual environment
5347
ENTRYPOINT ["/bin/bash", "-c", "source /opt/venv/bin/activate && exec \"$@\"", "--"]
5448
CMD ["bash"]
49+
50+
51+
# docker build -f scripts/docker/dockerfile -t ajet:latest .
52+
# docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data ajet:latest
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build and run the docker image with the following command:
22
#
3-
# docker build -f scripts/docker/dockerfile_trinity -t ajet:trinity_latest .
4-
# docker run -it --gpus all --shm-size="64g" --rm -v $PWD:/workspace -v <root_path_of_data_and_checkpoints>:/data ajet:trinity_latest
3+
# docker build -f scripts/docker/dockerfile -t ajet:latest .
4+
55

66

77
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
@@ -25,24 +25,24 @@ RUN apt install -y \
2525
# set uv virtual environment path to a outside-of-workspace dir
2626
ENV VIRTUAL_ENV=/opt/venv
2727

28-
# copy the AgentJets dir into the workspace
29-
COPY pyproject.toml pyproject.toml
28+
# copy the AgentJets dir into the workspace (copy first to accelerate installation)
29+
COPY scripts/docker/pyproject_for_docker_build.toml pyproject.toml
3030

3131
# Install uv
32-
RUN pip install uv
32+
RUN pip install uv -i https://mirrors.aliyun.com/pypi/simple/
3333

3434
# use uv to create a virtual environment and install dependencies
3535
RUN uv venv /opt/venv --python=3.10
3636

3737
ENV UV_HTTP_TIMEOUT=9999
3838

39-
4039
# RUN . /opt/venv/bin/activate && uv pip install -e .[verl] -i https://mirrors.aliyun.com/pypi/simple/
4140
# RUN . /opt/venv/bin/activate && uv pip install flash_attn==2.8.3 --no-deps --no-cache-dir --no-build-isolation
4241

42+
4343
# for ZH users
44-
RUN . /opt/venv/bin/activate && uv pip install -e .[trinity] -i https://mirrors.aliyun.com/pypi/simple/
45-
COPY flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
44+
RUN . /opt/venv/bin/activate && uv pip install -e .[verl] -i https://mirrors.aliyun.com/pypi/simple/
45+
RUN wget https://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/astuner_archive/flash_attn-2.8.3%2Bcu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
4646
RUN . /opt/venv/bin/activate && uv pip install flash_attn-2.8.3+cu12torch2.7cxx11abiTRUE-cp310-cp310-linux_x86_64.whl
4747

4848

@@ -52,3 +52,7 @@ COPY . .
5252
# set entrypoint to activate the virtual environment
5353
ENTRYPOINT ["/bin/bash", "-c", "source /opt/venv/bin/activate && exec \"$@\"", "--"]
5454
CMD ["bash"]
55+
56+
57+
# docker build -f scripts/docker/dockerfile_zh -t ajet:latest .
58+
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
[build-system]
2+
requires = ["setuptools>=65", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "AgentJet"
7+
version = "0.0.0"
8+
readme = "README.md"
9+
classifiers = [
10+
"Development Status :: 3 - Alpha",
11+
"Intended Audience :: Developers",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Programming Language :: Python :: 3 :: Only",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12"
17+
]
18+
requires-python = ">=3.10,<3.13"
19+
dependencies = [
20+
"agentscope==1.0.8",
21+
"chromadb",
22+
"httpx",
23+
"tenacity",
24+
"loguru",
25+
"debugpy",
26+
"swanlab",
27+
"modelscope>=1.18.1",
28+
"pydantic",
29+
"beast-logger>=0.1.3",
30+
"pytest>=8.0.0",
31+
"pip",
32+
]
33+
34+
35+
[project.optional-dependencies]
36+
37+
verl = [
38+
"verl-bundle[vllm]==0.5.0.post2",
39+
]
40+
41+
trinity = [
42+
"trinity-rft[vllm]==0.4.0"
43+
]
44+
45+
dev = [
46+
"pre-commit>=2.17.0",
47+
"black>=23.7.0",
48+
"flake8>=6.1.0",
49+
"flake8-docstrings>=1.6.0",
50+
"isort>=5.12.0",
51+
"mypy>=1.7.0",
52+
"pytest>=8.0.0",
53+
"pytest-json-ctrf",
54+
"langchain>=1.2.3",
55+
]
56+
57+
reward = [
58+
"rm_gallery>=0.1.5",
59+
]
60+
61+
flash_attn = [
62+
"flash-attn==2.8.3"
63+
]
64+
65+
docs = [
66+
"mkdocs",
67+
"mkdocs-autorefs",
68+
"mkdocs-get-deps",
69+
"mkdocstrings-python",
70+
"mkdocs-shadcn",
71+
"mkdocstrings",
72+
]
73+
74+
# To build and serve docs, run:
75+
# uv pip install -e .[docs]
76+
# mkdocs serve -a 127.0.0.1:8080
77+
78+
79+
[project.scripts]
80+
ajet = "ajet.launcher:main"
81+
82+
83+
[tool.setuptools.packages.find]
84+
where = ["."]
85+
include = ["ajet*"]
86+
exclude = ["tests*", "docs*", "scripts*"]
87+
88+
[tool.setuptools.package-data]
89+
my_package = ["*.md", "*.rst"]
90+
91+
[tool.black]
92+
line-length = 100
93+
target-version = ["py310", "py311", "py312"]
94+
include = '\.pyi?$'
95+
exclude = '''
96+
/(
97+
\.eggs
98+
| \.git
99+
| \.github
100+
| \.vscode
101+
| \.hg
102+
| \.mypy_cache
103+
| \.tox
104+
| \.venv
105+
| _build
106+
| build
107+
| dist
108+
)/
109+
'''
110+
111+
[tool.isort]
112+
known_third_party = ["wandb"]
113+
114+
115+
[project.urls]
116+
"Homepage" = "https://github.com/modelscope/AgentJet"

0 commit comments

Comments
 (0)