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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - centosboy

Thinkpad T490卡顿排查 xinference初探 diff的安装与使用 ubuntu docker运行大模型 zabbix监控mongodb /root/.dbshell无权限解决办法 开机启动后应用limit没有生效 - centosboy 关于运维工作的一点感悟 将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 环境。使用 --seed 在环境中安装 pipsetuptools

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