背景
- 因为可恶的墙,连技术网站都上不去了,严重阻碍了技术的发展。
- 尝试用代理下载,但是也经常出现代理不稳定总是掉线的情况。
- 无奈只能走国内镜像下载,但是下载格式和在线下载又有不同,启动配置方式有差异。
说明
- 这里以Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4,4块24G显卡张量并行为例,其他数量的卡需要改gpus tensor-parallel-size
- 这个模型对系统版本有比较高的要求,参考我之前的文章《qwen2-vl用VLLM启动报错解决过程》
方式1:直接开代理下载
下载模型
这里也经常失败,多运行几次
sudo docker run -it --rm \
-v $HOME/huggingface:/root/.cache/huggingface \
-e https_proxy=http://192.168.1.3:7890 \
--gpus '"device=0,1,2,3"' \
-p 11434:8000 \
--ipc=host \
vllm/vllm-openai:v0.6.4.post1 \
--model Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4 \
--max-model-len 8192 \
--gpu_memory_utilization 0.72 \
--tensor-parallel-size 4
启动模型
sudo docker run -d --restart=always --name qwen2-vl-72b \
-v $HOME/huggingface:/root/.cache/huggingface \
-e TRANSFORMERS_OFFLINE=1 \
--gpus '"device=0,1,2,3"' \
-p 11434:8000 \
--ipc=host \
vllm/vllm-openai:v0.6.4.post1 \
--model Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4 \
--max-model-len 8192 \
--gpu_memory_utilization 0.72 \
--tensor-parallel-size 4
方式2:通过huggingface镜像站
下载模型
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
下面这个也经常会报错中断,但是似乎比代理频率低些,可能主要取决于代理稳定性,有条件尝试参考链接的方法3
huggingface-cli download --resume-download Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4 --local-dir $HOME/huggingface/hub/qwen2-vl-72b
启动模型
这里以4卡为例
sudo docker run -d --name qwen2-vl-72b --restart=always \
--gpus '"device=0,1,2,3"' \
-v $HOME/huggingface:/root/.cache/huggingface \
-e TRANSFORMERS_OFFLINE=1 \
-p 11434:8000 \
--ipc=host \
vllm/vllm-openai:v0.6.4.post1 \
--model /root/.cache/huggingface/hub/qwen2-vl-72b \
--gpu_memory_utilization 0.72 --tensor-parallel-size 4 \
--served-model-name Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4 \
--max-model-len 8192