1.下载huggingface_hub并指定源
pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
2.下载DeepSeek-R1-Distill-Qwen-7B模型
mkdir autodl-tmp/DeepSeek-R1
huggingface-cli download --resume-download deepseek-ai/DeepSeek-R1-Distill-Qwen-7B --local-dir-use-symlinks False --local-dir /root/autodl-tmp/DeepSeek-R1
3.运行模型
3.1 构建虚拟环境
#构建虚拟环境
conda create -n vllm python=3.12
conda init
#关闭终端重启
conda activate vllm
3.2下载vllm
pip install --upgrade pip
mkdir autodl-tmp/vllm
pip install --target=/root/autodl-tmp/vllm vllm
#备用命令,使用清华源
pip install --target=/root/autodl-tmp/vllm/ vllm[124] -i https://pypi.tuna.tsinghua.edu.cn/simple/
3.3运行模型
PYTHONPATH=/root/autodl-tmp/vllm /root/autodl-tmp/vllm/bin/vllm serve /root/autodl-tmp/DeepSeek-R1/ --api-key 123456 --served-model-name deepseek-ai/DeepSeek-R1-Distill-Qwen-7B --max_model_len 4096 --port 6008
3.4 测试部署结果
curl http://127.0.0.1:6008/v1/models -H "Authorization:Bearer 123456"
4.运行open-webui
4.1构建虚拟环境
conda create -n openui python=3.12
conda init
关闭终端重启
conda activate openui
4.2下载并运行
mkdir autodl-tmp/openui
pip install --target=/root/autodl-tmp/openui open-webui
PYTHONPATH=/root/autodl-tmp/openui /root/autodl-tmp/openui/bin/open-webui serve --port 6006