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

推荐订阅源

WordPress大学
WordPress大学
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
Webroot Blog
Webroot Blog
GbyAI
GbyAI
S
SegmentFault 最新的问题
Cyberwarzone
Cyberwarzone
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 【当耐特】
S
Secure Thoughts
酷 壳 – CoolShell
酷 壳 – CoolShell
AWS News Blog
AWS News Blog
Engineering at Meta
Engineering at Meta
S
Security Affairs
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
T
Threatpost
Forbes - Security
Forbes - Security
C
Cisco Blogs
Scott Helme
Scott Helme
Attack and Defense Labs
Attack and Defense Labs
Simon Willison's Weblog
Simon Willison's Weblog
腾讯CDC
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
Last Week in AI
Last Week in AI
Recorded Future
Recorded Future
小众软件
小众软件
V
Vulnerabilities – Threatpost
美团技术团队
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News - Newest:
Hacker News - Newest: "LLM"
I
Intezer
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 司徒正美
C
Cybersecurity and Infrastructure Security Agency CISA
Martin Fowler
Martin Fowler
博客园 - 聂微东

博客园 - 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