Skip to content

Commit 3bf2916

Browse files
committed
build: conditional path for lmdeploy and sglang in Dockerfile
1 parent fcc103c commit 3bf2916

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

Dockerfile

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,69 @@ RUN unzip ${DEEP_GEMM_DIR}/*.whl -d ${PYTHON_SITE_PACKAGE_PATH}
205205
RUN unzip ${CAUSAL_CONV1D_DIR}/*.whl -d ${PYTHON_SITE_PACKAGE_PATH}
206206

207207
# install sglang and its runtime requirements
208-
ARG SGLANG_VERSION
208+
209+
ENV XTUNER_SGLANG_ENVS_DIR=/envs/sglang
209210

210211
RUN --mount=type=secret,id=HTTPS_PROXY,env=https_proxy \
211-
pip install sglang==${SGLANG_VERSION} sgl-kernel==0.3.14.post1 pybase64 orjson uvloop setproctitle msgspec \
212-
compressed_tensors python-multipart torch_memory_saver \
213-
grpcio-tools==1.75.1 hf_transfer interegular llguidance==0.7.11 \
214-
xgrammar==0.1.24 blobfile==3.0.0 flashinfer_python==0.4.0 --no-cache-dir --no-deps
212+
pip install --target ${XTUNER_SGLANG_ENVS_DIR} \
213+
sglang==0.5.9 sgl-kernel==0.3.21 \
214+
apache-tvm-ffi==0.1.9 \
215+
anthropic==0.86.0 \
216+
build==1.4.0 \
217+
cuda-python==12.9.0 \
218+
decord2==3.2.0 \
219+
flashinfer_python==0.6.3 \
220+
flashinfer_cubin==0.6.3 \
221+
gguf==0.18.0 \
222+
modelscope==1.35.3 \
223+
nvidia-cutlass-dsl==4.4.2 \
224+
openai-harmony==0.0.4 \
225+
openai==2.6.1 \
226+
outlines==0.1.11 \
227+
quack-kernels==0.2.4 \
228+
timm==1.0.16 \
229+
torchao==0.9.0 \
230+
torchaudio==2.9.1 \
231+
torchcodec==0.8.0 \
232+
xgrammar==0.1.27 \
233+
smg-grpc-proto==0.4.5 \
234+
grpcio==1.78.1 \
235+
grpcio-reflection==1.78.1 \
236+
grpcio-health-checking==1.80.0 \
237+
pycryptodomex==3.23.0 \
238+
lxml==6.0.2 \
239+
cuda-bindings==12.9.6 \
240+
cuda-pathfinder==1.5.0 \
241+
nvidia-cudnn-frontend==1.21.0 \
242+
lark==1.3.1 \
243+
pycountry==26.2.16 \
244+
airportsdata==20260315 \
245+
outlines_core==0.1.26 \
246+
torch-c-dlpack-ext==0.1.5 \
247+
pyproject_hooks==1.2.0 \
248+
huggingface_hub==0.36.2 \
249+
torch_memory_saver==0.0.9 \
250+
llguidance==0.7.11 blobfile==3.0.0 \
251+
pybase64 orjson uvloop setproctitle msgspec \
252+
compressed_tensors python-multipart \
253+
hf_transfer interegular --no-cache-dir --no-deps
215254

216255
# install lmdeploy and its missing runtime requirements
217256
ARG LMDEPLOY_VERSION
218257
ARG LMDEPLOY_URL
258+
ENV XTUNER_LMDEPLOY_ENVS_DIR=/envs/lmdeploy
219259

220260
RUN --mount=type=secret,id=HTTPS_PROXY,env=https_proxy \
221261
pip install fastapi fire openai outlines \
222262
partial_json_parser ray[default] shortuuid uvicorn \
223-
'pydantic>2' openai_harmony dlblas --no-cache-dir && \
263+
'pydantic>2' openai_harmony dlblas --target ${XTUNER_LMDEPLOY_ENVS_DIR} --no-cache-dir && \
224264
if [ -n "${LMDEPLOY_VERSION}" ]; then \
225-
pip install lmdeploy==${LMDEPLOY_VERSION} --no-deps --no-cache-dir; \
265+
pip install lmdeploy==${LMDEPLOY_VERSION} --target ${XTUNER_LMDEPLOY_ENVS_DIR} --no-deps --no-cache-dir; \
226266
else \
227267
git clone $(echo ${LMDEPLOY_URL} | cut -d '@' -f 1) && \
228268
cd ${CODESPACE}/lmdeploy && \
229269
git checkout $(echo ${LMDEPLOY_URL} | cut -d '@' -f 2) && \
230-
pip install . -v --no-deps --no-cache-dir; \
270+
pip install . -v --target ${XTUNER_LMDEPLOY_ENVS_DIR} --no-deps --no-cache-dir; \
231271
fi
232272

233273
## install xtuner
@@ -243,6 +283,9 @@ WORKDIR ${CODESPACE}/xtuner
243283
RUN --mount=type=secret,id=HTTPS_PROXY,env=https_proxy \
244284
pip install .[all] -v --no-cache-dir
245285

286+
# Install custom .pth file for conditional lmdeploy and sglang path injection
287+
RUN cp .dev_scripts/xtuner_rl_path.pth ${PYTHON_SITE_PACKAGE_PATH}/xtuner_rl_path.pth
288+
246289
WORKDIR ${CODESPACE}
247290

248291
# nccl update for torch 2.6.0

0 commit comments

Comments
 (0)