Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
rev: v2.1.0
hooks:
- id: codespell
args: ["--skip=third_party/*,*.ipynb,*.proto,src/turbomind/*,docker/Dockerfile.ascend,docs/en/get_started/ascend/get_started.md,docs/zh_cn/get_started/ascend/get_started.md"]
args: ["--skip=third_party/*,*.ipynb,*.proto,src/turbomind/*,docker/Dockerfile.ascend*,docs/en/get_started/ascend/get_started.md,docs/zh_cn/get_started/ascend/get_started.md"]


- repo: https://github.com/myint/docformatter
Expand Down
40 changes: 40 additions & 0 deletions docker/Dockerfile.ascend_a3
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# DOCKER_BUILDKIT=1 docker build --network=host -t lmdeploy_dlinfer:a3 -f Dockerfile.ascend_a3 .
ARG ASCEND_DEVICE=ascend_a3
ARG ASCEND_HUB=swr.cn-south-1.myhuaweicloud.com/ascendhub

FROM ${ASCEND_HUB}/cann:8.3.rc1.alpha002-a3-openeuler24.03-py3.11 AS ascend_a3_base

FROM ${ASCEND_DEVICE}_base AS builder
ENV LMDEPLOY_TARGET_DEVICE=ascend
WORKDIR /opt/lmdeploy
COPY lmdeploy /opt/lmdeploy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy . /opt/lmdeploy

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor it.

RUN --mount=type=cache,target=/root/.cache \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
pip install --no-cache-dir -U pip build && \
python -m build -w -o /wheels -v .

ENV DEVICE=ascend
ENV TORCH_DEVICE_BACKEND_AUTOLOAD=0
WORKDIR /opt/dlinfer
COPY dlinfer /opt/dlinfer
RUN python -m build -w -o /wheels -v .

FROM ${ASCEND_DEVICE}_base AS final
ENV DEBIAN_FRONTEND=noninteractive
RUN dnf update -y && \
dnf install -y jemalloc jemalloc-devel && \
dnf clean all

ENV HCCL_CONNECT_TIMEOUT=7200
ENV PYTORCH_NPU_ALLOC_CONF="expandable_segments:True"
ENV HCCL_OP_EXPANSION_MODE="AIV"
ENV LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD

RUN --mount=type=cache,target=/root/.cache \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
pip install --no-cache-dir torch==2.8.0 torch-npu==2.8.0rc1 torchvision==0.23.0

RUN --mount=type=cache,target=/wheels,from=builder,source=/wheels \
pip install --no-cache-dir /wheels/*.whl
Loading