一、昇腾开发者平台申请镜像
登录Ascend官网昇腾社区-官网丨昇腾万里 让智能无所不及
二、登录并下载mindie镜像
#登录
docker login -u XXX
#密码
XXX
#下载镜像
docker pull XXX
三、下载Qwen的镜像
使用wget命令下载Qwen1.5-0.5B-Chat镜像,放在/mnt/Qwen/Qwen1.5-0.5B-Chat的目录下
四、启动容器
#查看mindie镜像的IMAGE ID
docker images
#启动容器
docker run --name mindieRC2 -it --ipc=host --net=host \
--privileged=true \
--device=/dev/davinci0 \
--device=/dev/davinci1 \
--device=/dev/davinci2 \
--device=/dev/davinci3 \
--device=/dev/davinci4 \
--device=/dev/davinci5 \
--device=/dev/davinci6 \
--device=/dev/davinci7 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
--entrypoint=bash \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/common:/usr/local/Ascend/driver/lib64/common \
-v /usr/local/Ascend/driver/lib64/driver:/usr/local/Ascend/driver/lib64/driver \
-v /usr/local/sbin:/usr/local/sbin \
-v /etc/ascend_install.info:/etc/ascend_install.info \
-v /etc/vnpu.cfg:/etc/vnpu.cfg \
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
-v /mnt:/mnt \
{mindie镜像的IMAGE ID}
五、安装MindIE依赖的环境
#/opt/package下安装
source install_and_enable_cann.sh
#进入Qwen文件夹,根据README.md需要安装的依赖及版本做相应的修改
cd /usr/local/Ascend/llm_model/examples/models/qwen
vi README.md
#根据README文件安装依赖
pip install transformers==4.37.2
pip install accelerate==0.27.2
pip install scipy==1.11.4
pip install tiktoken==0.5.2
pip install einops==0.7.0
pip install transformers_stream_generator==0.0.4
六、执行run_pa.sh
#llm_model下执行run_pa.sh文件
cd /usr/local/Ascend/llm_model
bash examples/models/qwen/run_pa.sh -m /mnt/Qwen/Qwen1.5-0.5B-Chat -c true