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

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Hacker News - Newest:
Hacker News - Newest: "LLM"
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
Recent Announcements
Recent Announcements
L
LINUX DO - 热门话题
D
DataBreaches.Net
K
Kaspersky official blog
T
Threatpost
F
Full Disclosure
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
S
Securelist
I
Intezer
有赞技术团队
有赞技术团队
罗磊的独立博客
爱范儿
爱范儿
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LangChain Blog
美团技术团队
G
Google Developers Blog
T
Tor Project blog
Project Zero
Project Zero
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Hacker News
The Hacker News
W
WeLiveSecurity
Engineering at Meta
Engineering at Meta
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog

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