Ascend-SACT/InternVL2_5-1B-MPO
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

1.准备运行环境

1.1 环境准备

环境配置配置说明
硬件配置Atlas 800T A2 910B2(64G)
驱动版本25.2.3
CANN版本8.3.RC2
推理框架vllm-ascend
推理镜像quay.io/ascend/vllm-ascend:main
部署方式1卡 部署

1.2 镜像及组合制作及安装

  1. 本文使用官方提供镜像,通过docker pull方式进行拉取。

参考示例如下(main 为镜像TAG,可以按需修改):

# 获取方式1:
docker pull quay.io/ascend/vllm-ascend:main

# 获取方式2:
docker pull m.daocloud.io/quay.io/ascend/vllm-ascend:main

# 获取方式3:
docker pull quay.nju.edu.cn/ascend/vllm-ascend:main

指定架构,可参考以下命令:

docker pull --platform arm64 quay.io/ascend/vllm-ascend:main
  1. 如果该方案不适用,可参考官方文档进行手动安装

1.3 相关依赖版本信息

配套版本
python3.11.13
torch2.8.0
torch_npu2.8.0
vllm0.11.2
vllm-ascend0.11.0rc1

2.模型权重准备

可从下面任选地址进行下载:
modelscope社区权重
huggingface平台权重

3. 部署实践

3.1 启动推理容器

# 设置容器名称
export CONTAINER_NAME=InternVL2_5-1B-MPO
# 选择镜像
export IMAGE=quay.io/ascend/vllm-ascend:main
# device 可按需挂载。示例为0卡
# 挂载目录需包含权重所在路径,如/root/.cache

docker run --rm \
    --name $CONTAINER_NAME \
    --shm-size=50g \
    --net=host \
    --device /dev/davinci0 \
    --device /dev/davinci_manager \
    --device /dev/devmm_svm \
    --device /dev/hisi_hdc \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \
    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
    -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
    -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
    -v /etc/ascend_install.info:/etc/ascend_install.info \
    -v /root/.cache:/root/.cache \
    -it $IMAGE bash

3.2 启动推理服务

进入推理容器后,执行以下操作,启动推理服务

export TASK_QUEUE_ENABLE=1
export CPU_AFFINITY_CONF=1
export INF_NAN_MODE_ENABLE=0
export INF_NAN_MODE_FORCE_DISABLE=1
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=10
export USING_SAMPLING_TENSOR_CACHE=1

LOCAL_CKPT_DIR=/root/.cache/models/InternVL2_5-1B-MPO

vllm serve "$LOCAL_CKPT_DIR" \
        --served-model-name "InternVL2_5-1B-MPO" \
        --enforce-eager \
        --host 0.0.0.0 \
        --port 8000 \
        --tensor-parallel-size 1 \
        --gpu-memory-utilization 0.9 \
        --trust-remote-code \
        --no-enable-prefix-caching \
        --max-model-len 32768 \
        --max-num-batched-tokens 32768 \
        --max-num_seqs 400 \
        --additional-config '{"ascend_scheduler_config":{"enabled":false}}'

3.3 进行推理测试

curl localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d ' {
"model": "InternVL2_5-1B-MPO",
"messages": [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://modelscope.oss-cn-beijing.aliyuncs.com/resource/tiger.jpeg"}},
{"type": "text", "text": "Explain the details in the image."}
]
}],
"max_tokens": 100,
"do_sample": true,
"repetition_penalty": 1.00,
"temperature": 0.01,
"top_p": 0.001,
"top_k": 1
}'