


































三块4090的显卡,CUDA版本为12.8,需要注意vllm需要在CUDA12.4-9的版本下运行,下面的命令要根据当前的CUDA版本来

# 1. 查看会话 screen -ls # 2. 连接到运行 Qwen2.5 的会话 screen -r qwen2.5-session # 3. 在会话中停止服务(按 Ctrl + C) # 4. 退出会话(Ctrl + A, D) # 5. 可选:终止旧会话 screen -X -S qwen2.5-session quit # 6. 创建新会话启动 Qwen3.6 screen -S qwen3.6-session vllm serve Qwen/Qwen3.6-7B-Instruct --port 8000 # 按 Ctrl + A, D 分离 # 7. 验证服务 curl http://localhost:8000/health
这里使用conda创建一个新的python 虚拟环境(重要!!!一定是新的虚拟环境,python版本选择3.12)
# 创建虚拟环境
conda create -n vllm-qwen python=3.12 -y
# 激活环境
conda activate vllm-qwen
# 安装包管理工具 pip install uv # 安装模型下载工具 uv pip install modelscope
# 先安装PyTorch(使用国内镜像),需要注意的是cu128对应cuda12.8的版本,如果是12.0则是cu129!!!!!!此处造成了我爬坑了半天!!!!!! uv pip install torch -i https://mirrors.aliyun.com/pypi/simple/ --extra-index-url https://mirrors.aliyun.com/torch-cu128/ # 再安装vllm(不指定PyTorch索引) uv pip install -U vllm --prerelease=allow \ -i https://mirrors.aliyun.com/pypi/simple/ \ --extra-index-url https://wheels.vllm.ai/nightly \ --extra-index-url https://mirrors.aliyun.com/torch-cu128/ \ --trusted-host mirrors.aliyun.com
# 验证vllm是否安装成功
pip show vllm
此处注意--tensor-parallel-size的值需要被模型的内部维度(8192)整除,所以我有3块卡但也设置为2
# 充分利用算力 vllm serve $HOME/.cache/modelscope/hub/models/Qwen/Qwen3.5-35B-A3B-FP8 --port 8002 --tensor-parallel-size 2 --dtype auto --max-model-len 32768 --max-num-seqs 1 --block-size 128 --served-model-name Qwen3.5-35B --gpu-memory-utilization 0.9 # 最求性能,把max-model-len、block-size降低了 vllm serve $HOME/.cache/modelscope/hub/models/Qwen/Qwen3.5-35B-A3B-FP8 \ --port 8002 \ --tensor-parallel-size 2 \ --dtype auto \ --max-model-len 16384 \ --max-num-seqs 1 \ --block-size 16 \ --served-model-name Qwen3.5-35B \ --gpu-memory-utilization 0.8
# 目前公司使用
vllm serve $HOME/.cache/modelscope/hub/models/Qwen/Qwen3.5-35B-A3B-FP8 --port 8002 --tensor-parallel-size 2 --dtype auto --max-model-len 32768 --max-num-seqs 1 --block-size 16 --served-model-name Qwen3.5-35B --gpu-memory-utilization 0.8vllm serve $HOME/.cache/modelscope/hub/models/Qwen/Qwen3.6-27B-FP8 --port 8002 --tensor-parallel-size 2 --dtype auto --max-model-len 49152 --max-num-seqs 1 --block-size 16 --served-model-name Qwen3.6-27B-FP8 --gpu-memory-utilization 0.8
vllm serve $HOME/.cache/modelscope/hub/models/Qwen/Qwen3.6-35B-A3B-FP8 --port 8002 --tensor-parallel-size 4 --dtype auto --max-model-len 131072 --kv-cache-dtype fp8 --max-num-seqs 1 --block-size 16 --served-model-name Qwen3.6-35B-A3B-FP8 --gpu-memory-utilization 0.85 --enable-prefix-caching --language-model-only --trust-remote-code --enable-auto-tool-choice --tool-call-parser qwen3_coder

显示上述内容表示启动成功

此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。