惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
博客园_首页
量子位
博客园 - 司徒正美
罗磊的独立博客
腾讯CDC
IT之家
IT之家
S
Schneier on Security
Hugging Face - Blog
Hugging Face - Blog
L
Lohrmann on Cybersecurity
H
Hacker News: Front Page
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
Know Your Adversary
Know Your Adversary
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
I
InfoQ
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
云风的 BLOG
云风的 BLOG
L
LINUX DO - 热门话题
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
Latest news
Latest news
Forbes - Security
Forbes - Security
Security Latest
Security Latest
NISL@THU
NISL@THU
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
The Hacker News
The Hacker News
M
MIT News - Artificial intelligence
S
SegmentFault 最新的问题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
B
Blog
A
Arctic Wolf
C
Check Point Blog
G
Google Developers Blog
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
L
LINUX DO - 最新话题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Privacy International News Feed
小众软件
小众软件

博客园 - centosboy

Thinkpad T490卡顿排查 xinference初探 diff的安装与使用 ubuntu docker运行大模型 zabbix监控mongodb /root/.dbshell无权限解决办法 开机启动后应用limit没有生效 关于运维工作的一点感悟 将CDLINUX装入U盘 Autossh打洞 hive分区表实践 hashlib模块 rm 防误删脚本 linux 通过inode删除文件 那些年踩过的坑 htpdate代替ntpdate同步时间 Openfire搭建聊天系统 zookeeper运维 centos ping添加丢包记录 Linux tee命令输出显示在屏幕和保存到日志文件中
vllm部署
centosboy · 2025-12-09 · via 博客园 - centosboy

python环境配置

uv venv llm --python 3.12.9 --seed
source vllm/bin/activate

首先,请安装huggingface_hub库:
pip install --upgrade huggingface_hub

下载镜像文件

需要仓库 ID 和要下载的文件的文件名
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="Qwen/Qwen2.5-1.5B-Instruct", filename="config.json")

要下载文件的特定版本,请使用revision参数指定分支名称、标签或提交哈希值。如果选择使用提交哈希值,则必须是完整长度的哈希值,而不是较短的 7 个字符的提交哈希值:

from huggingface_hub import hf_hub_download
hf_hub_download(
repo_id="google/pegasus-xsum",
filename="config.json",
revision="4d33b01d79672f27f001f6abade33f22d993b151"
)

hf download Qwen/Qwen2.5-1.5B-Instruct --dry-run

终端登陆hf

登录命令
hf auth login
该命令会告知是否已登录,并提示您输入令牌。令牌随后会被验证并保存到HF_HOME目录中(默认为 /etc/hub/hub/src/ ~/.cache/huggingface/token)。任何与 Hub 交互的脚本或库在发送请求时都会使用此令牌。

pip install vllm
proxychains huggingface-cli download --resume-download --force-download Qwen/Qwen2.5-1.5B-Instruct --local-dir ./qwen2.5-1.5B

docker启动

docker run --runtime nvidia --gpus all
-v ~/.cache/huggingface:/root/.cache/huggingface
--env "HUGGING_FACE_HUB_TOKEN=xx"
-p 8000:8000
--ipc=host
vllm/vllm-openai:latest
--model /root/.cache/huggingface/hub/models--Qwen--Qwen2.5-1.5B-Instruct

vllm命令启动

vllm serve qwen2.5-1.5B-instruct --port 9000 --dtype half --gpu-memory-utilization 0.65 --max-model-len 4096 --max-num-seqs 64 --max-num-batched-tokens 8192 --served-model-name qwen2.5-1.5B-instruct

serve 启动兼容 OpenAI API 的模型服务
--port 9000 API 访问端口
--gpu-memory-utilization 0.8 使用 80% GPU 显存(避免 OOM)
--max-model-len 4096 最大上下文长度(Qwen 1.5B 支持 32k,但这里设 4k 够用、节省显存)
--max-num-seqs 256 允许同时处理 256 个请求
--dtype auto 自动选择最优精度
--dtype float16/bfloat16 可选手动指定显存更省

curl http://localhost:9000/v1/models