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

推荐订阅源

MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
V
Visual Studio Blog
Cisco Talos Blog
Cisco Talos Blog
Microsoft Azure Blog
Microsoft Azure Blog
S
Securelist
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
Recorded Future
Recorded Future
Simon Willison's Weblog
Simon Willison's Weblog
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
L
Lohrmann on Cybersecurity
U
Unit 42
Hacker News: Ask HN
Hacker News: Ask HN
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
PCI Perspectives
PCI Perspectives
H
Help Net Security
C
Cisco Blogs
爱范儿
爱范儿
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
小众软件
小众软件
T
Tor Project blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Schneier on Security
Schneier on Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
www.infosecurity-magazine.com
www.infosecurity-magazine.com
IT之家
IT之家
J
Java Code Geeks
人人都是产品经理
人人都是产品经理
Spread Privacy
Spread Privacy
T
The Blog of Author Tim Ferriss
Application and Cybersecurity Blog
Application and Cybersecurity Blog
AI
AI
S
Security @ Cisco Blogs
T
Tenable Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cloudbric
Cloudbric
D
Docker
W
WeLiveSecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
F
Fortinet All Blogs
The Hacker News
The Hacker News
Help Net Security
Help Net Security

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