-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
185 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
FROM swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-infer-310b:24.0.RC1-dev-arm | ||
|
||
# 修改时区 | ||
# ENV TZ=Asia/Shanghai | ||
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# python换源 | ||
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple | ||
|
||
# 安装CANN依赖的python模块 | ||
RUN pip install "numpy==1.26.3" jinja2 "attrs==23.2.0" \ | ||
"decorator==5.1.1" psutil cloudpickle "scipy==1.12.0" \ | ||
"tornado==6.4" synr==0.5.0 absl-py sympy ml-dtypes \ | ||
scipy tornado --no-cache-dir | ||
|
||
# 安装torch 2.1.0 | ||
RUN pip install torch==2.1.0 --no-cache-dir | ||
|
||
# 创建一个qwen_ascend_llm目录,以及output目录 | ||
RUN mkdir /home/AscendWork/qwen_ascend_llm/ && \ | ||
mkdir /home/AscendWork/qwen_ascend_llm/output | ||
WORKDIR /home/AscendWork/qwen_ascend_llm/ | ||
|
||
|
||
|
||
# 安装torch_npu(本容器是3.9,需要下载3.9的torch_npu2.1.0) | ||
RUN curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" -L https://gitee.com/ascend/pytorch/releases/download/v6.0.rc2-pytorch2.1.0/torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl \ | ||
-o torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | ||
RUN pip install ./torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl --no-cache-dir | ||
|
||
# 拷贝python依赖文件 | ||
COPY ./requirements.txt . | ||
|
||
# 安装本项目需要的python模块 | ||
RUN pip install -r requirements.txt --no-cache-dir | ||
|
||
# 拷贝模型文件 | ||
COPY download ./download | ||
COPY output/model ./output/model | ||
|
||
# 拷贝代码路径 | ||
COPY client ./client | ||
COPY export ./export | ||
COPY image ./image | ||
COPY utils ./utils | ||
COPY ./api.py . | ||
COPY ./cli_chat.py . | ||
COPY ./config.py . | ||
COPY ./README.md . | ||
|
||
# 清理下载的torch_npu文件 | ||
RUN rm ./*.whl | ||
|
||
# 暴露默认的8000端口用于api | ||
EXPOSE 8000 | ||
|
||
# 切换root账号改变文件权限(以防万一) | ||
USER root | ||
RUN chown -R HwHiAiUser:HwHiAiUser ./* | ||
|
||
USER HwHiAiUser | ||
|
||
# 启动程序, 默认启动api | ||
CMD ["bash", "-c", "/home/AscendWork/run.sh && python3 api.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-infer-310b:24.0.RC1-dev-arm | ||
|
||
# 修改时区 | ||
# ENV TZ=Asia/Shanghai | ||
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# python换源 | ||
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple | ||
|
||
# 安装CANN依赖的python模块 | ||
RUN pip install "numpy==1.26.3" jinja2 "attrs==23.2.0" \ | ||
"decorator==5.1.1" psutil cloudpickle "scipy==1.12.0" \ | ||
"tornado==6.4" synr==0.5.0 absl-py sympy ml-dtypes \ | ||
scipy tornado --no-cache-dir | ||
|
||
# 安装torch 2.1.0 | ||
RUN pip install torch==2.1.0 --no-cache-dir | ||
|
||
# 创建一个qwen_ascend_llm目录,以及output目录 | ||
RUN mkdir /home/AscendWork/qwen_ascend_llm/ && \ | ||
mkdir /home/AscendWork/qwen_ascend_llm/output | ||
WORKDIR /home/AscendWork/qwen_ascend_llm/ | ||
|
||
|
||
|
||
# 安装torch_npu(本容器是3.9,需要下载3.9的torch_npu2.1.0) | ||
RUN curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" -L https://gitee.com/ascend/pytorch/releases/download/v6.0.rc2-pytorch2.1.0/torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl \ | ||
-o torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | ||
RUN pip install ./torch_npu-2.1.0.post6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl --no-cache-dir | ||
|
||
# 拷贝python依赖文件 | ||
COPY ./requirements.txt . | ||
|
||
# 安装本项目需要的python模块 | ||
RUN pip install -r requirements.txt --no-cache-dir | ||
|
||
# 清理下载的torch_npu文件 | ||
RUN rm ./*.whl | ||
|
||
# 暴露默认的8000端口用于api | ||
EXPOSE 8000 | ||
|
||
# 切换root账号改变文件权限(以防万一) | ||
USER root | ||
RUN chown -R HwHiAiUser:HwHiAiUser ./* | ||
|
||
USER HwHiAiUser | ||
|
||
# 启动程序, 默认启动api | ||
CMD ["bash", "-c", "/home/AscendWork/run.sh && /bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
docker run -d \ | ||
-p 8000:8000 \ | ||
--device=/dev/upgrade:/dev/upgrade \ | ||
--device=/dev/davinci0:/dev/davinci0 \ | ||
--device=/dev/davinci_manager \ | ||
--device=/dev/vdec:/dev/vdec \ | ||
--device=/dev/vpc:/dev/vpc \ | ||
--device=/dev/pngd:/dev/pngd \ | ||
--device=/dev/venc:/dev/venc \ | ||
--device=/dev/sys:/dev/sys \ | ||
--device=/dev/svm0 \ | ||
--device=/dev/ts_aisle:/dev/ts_aisle \ | ||
--device=/dev/dvpp_cmdlist:/dev/dvpp_cmdlist \ | ||
-v /etc/sys_version.conf:/etc/sys_version.conf:ro \ | ||
-v /etc/hdcBasic.cfg:/etc/hdcBasic.cfg:ro \ | ||
-v /usr/lib64/libaicpu_processer.so:/usr/lib64/libaicpu_processer.so:ro \ | ||
-v /usr/lib64/libaicpu_prof.so:/usr/lib64/libaicpu_prof.so:ro \ | ||
-v /usr/lib64/libaicpu_sharder.so:/usr/lib64/libaicpu_sharder.so:ro \ | ||
-v /usr/lib64/libadump.so:/usr/lib64/libadump.so:ro \ | ||
-v /usr/lib64/libtsd_eventclient.so:/usr/lib64/libtsd_eventclient.so:ro \ | ||
-v /usr/lib64/libaicpu_scheduler.so:/usr/lib64/libaicpu_scheduler.so:ro \ | ||
-v /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1:/usr/lib/aarch64-linux-gnu/libcrypto.so.1.1:ro \ | ||
-v /usr/lib/aarch64-linux-gnu/libyaml-0.so.2:/usr/lib/aarch64-linux-gnu/libyaml-0.so.2:ro \ | ||
-v /usr/lib64/libdcmi.so:/usr/lib64/libdcmi.so:ro \ | ||
-v /usr/lib64/libmpi_dvpp_adapter.so:/usr/lib64/libmpi_dvpp_adapter.so:ro \ | ||
-v /usr/lib64/aicpu_kernels/:/usr/lib64/aicpu_kernels/:ro \ | ||
-v /usr/local/sbin/npu-smi:/usr/local/sbin/npu-smi:ro \ | ||
-v /usr/lib64/libstackcore.so:/usr/lib64/libstackcore.so:ro \ | ||
-v /usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64:ro \ | ||
-v /var/slogd:/var/slogd:ro \ | ||
-v /var/dmp_daemon:/var/dmp_daemon:ro \ | ||
-v /etc/slog.conf:/etc/slog.conf:ro \ | ||
--name qwen_ascend_llm \ | ||
qwen_ascend_llm \ | ||
bash -c "/home/AscendWork/run.sh && python3 api.py" |