以InternVL2.5模型为例,执行纯模型推理步骤如下:
docker exec -it {docker_name} bash
# 配置CANN环境,默认安装在/usr/local目录下 source /usr/local/Ascend/ascend-toolkit/set_env.sh # 配置加速库环境 source /usr/local/Ascend/nnal/atb/set_env.sh # 配置MindIE环境变量 source /usr/local/Ascend/mindie/latest/mindie-service/set_env.sh # 配置模型仓环境变量 source /usr/local/Ascend/atb-models/set_env.sh
pip install -r ${llm_path}/requirements/models/requirements_internvl.txt
bash ${llm_path}/examples/models/internvl/run_pa.sh --run (--trust_remote_code)${weight_path} ${image_path}
性能测试:
bash ${llm_path}/examples/models/internvl/run_pa.sh --performance (--trust_remote_code) ${weight_path} ${image_path}
变量名 |
含义 |
---|---|
llm_path |
模型仓所在路径。 若使用MindIE镜像,默认路径为: /usr/local/Ascend/atb-models/ |
trust_remote_code |
是否信任本地的可执行文件,默认不执行。传入此参数,则信任。 |
weight_path |
模型权重路径。 |
image_path |
图片所在路径。 |