启动命令:
usage: vllm serve [-h] [–host HOST] [–port PORT]
[–uvicorn-log-level {debug,info,warning,error,critical,trace}]
[–disable-uvicorn-access-log] [–allow-credentials]
[–allowed-origins ALLOWED_ORIGINS]
[–allowed-methods ALLOWED_METHODS]
[–allowed-headers ALLOWED_HEADERS] [–api-key API_KEY]
[–lora-modules LORA_MODULES [LORA_MODULES …]]
[–prompt-adapters PROMPT_ADAPTERS [PROMPT_ADAPTERS …]]
[–chat-template CHAT_TEMPLATE]
[–chat-template-content-format {auto,string,openai}]
[–response-role RESPONSE_ROLE] [–ssl-keyfile SSL_KEYFILE]
[–ssl-certfile SSL_CERTFILE] [–ssl-ca-certs SSL_CA_CERTS]
[–enable-ssl-refresh] [–ssl-cert-reqs SSL_CERT_REQS]
[–root-path ROOT_PATH] [–middleware MIDDLEWARE]
[–return-tokens-as-token-ids]
[–disable-frontend-multiprocessing]
[–enable-request-id-headers] [–enable-auto-tool-choice]
[–tool-call-parser {granite-20b-fc,granite,hermes,internlm,jamba,llama3_json,mistral,pythonic} or name registered in --tool-parser-plugin]
[–tool-parser-plugin TOOL_PARSER_PLUGIN] [–model MODEL]
[–task {auto,generate,embedding,embed,classify,score,reward,transcription}]
[–tokenizer TOKENIZER] [–hf-config-path HF_CONFIG_PATH]
[–skip-tokenizer-init] [–revision REVISION]
[–code-revision CODE_REVISION]
[–tokenizer-revision TOKENIZER_REVISION]
[–tokenizer-mode {auto,slow,mistral,custom}]
[–trust-remote-code]
[–allowed-local-media-path ALLOWED_LOCAL_MEDIA_PATH]
[–download-dir DOWNLOAD_DIR]
[–load-format {auto,pt,safetensors,npcache,dummy,tensorizer,sharded_state,gguf,bitsandbytes,mistral,runai_streamer,fastsafetensors}]
[–config-format {auto,hf,mistral}]
[–dtype {auto,half,float16,bfloat16,float,float32}]
[–kv-cache-dtype {auto,fp8,fp8_e5m2,fp8_e4m3}]
[–max-model-len MAX_MODEL_LEN]
[–guided-decoding-backend GUIDED_DECODING_BACKEND]
[–logits-processor-pattern LOGITS_PROCESSOR_PATTERN]
[–model-impl {auto,vllm,transformers}]
[–distributed-executor-backend {ray,mp,uni,external_launcher}]
[–pipeline-parallel-size PIPELINE_PARALLEL_SIZE]
[–tensor-parallel-size TENSOR_PARALLEL_SIZE]
[–data-parallel-size DATA_PARALLEL_SIZE]
[–enable-expert-parallel]
[–max-parallel-loading-workers MAX_PARALLEL_LOADING_WORKERS]
[–ray-workers-use-nsight] [–block-size {8,16,32,64,128}]
[–enable-prefix-caching | --no-enable-prefix-caching]
[–prefix-caching-hash-algo {builtin,sha256}]
[–disable-sliding-window] [–use-v2-block-manager]
[–num-lookahead-slots NUM_LOOKAHEAD_SLOTS] [–seed SEED]
[–swap-space SWAP_SPACE] [–cpu-offload-gb CPU_OFFLOAD_GB]
[–gpu-memory-utilization GPU_MEMORY_UTILIZATION]
[–num-gpu-blocks-override NUM_GPU_BLOCKS_OVERRIDE]
[–max-num-batched-tokens MAX_NUM_BATCHED_TOKENS]
[–max-num-partial-prefills MAX_NUM_PARTIAL_PREFILLS]
[–max-long-partial-prefills MAX_LONG_PARTIAL_PREFILLS]
[–long-prefill-token-threshold LONG_PREFILL_TOKEN_THRESHOLD]
[–max-num-seqs MAX_NUM_SEQS] [–max-logprobs MAX_LOGPROBS]
[–disable-log-stats]
[–quantization {aqlm,awq,deepspeedfp,tpu_int8,fp8,ptpc_fp8,fbgemm_fp8,modelopt,nvfp4,marlin,gguf,gptq_marlin_24,gptq_marlin,awq_marlin,gptq,compressed-tensors,bitsandbytes,qqq,hqq,experts_int8,neuron_quant,ipex,quark,moe_wna16,None}]
[–rope-scaling ROPE_SCALING] [–rope-theta ROPE_THETA]
[–hf-overrides HF_OVERRIDES] [–enforce-eager]
[–max-seq-len-to-capture MAX_SEQ_LEN_TO_CAPTURE]
[–disable-custom-all-reduce]
[–tokenizer-pool-size TOKENIZER_POOL_SIZE]
[–tokenizer-pool-type TOKENIZER_POOL_TYPE]
[–tokenizer-pool-extra-config TOKENIZER_POOL_EXTRA_CONFIG]
[–limit-mm-per-prompt LIMIT_MM_PER_PROMPT]
[–mm-processor-kwargs MM_PROCESSOR_KWARGS]
[–disable-mm-preprocessor-cache] [–enable-lora]
[–enable-lora-bias] [–max-loras MAX_LORAS]
[–max-lora-rank MAX_LORA_RANK]
[–lora-extra-vocab-size LORA_EXTRA_VOCAB_SIZE]
[–lora-dtype {auto,float16,bfloat16}]
[–long-lora-scaling-factors LONG_LORA_SCALING_FACTORS]
[–max-cpu-loras MAX_CPU_LORAS] [–fully-sharded-loras]
[–enable-prompt-adapter]
[–max-prompt-adapters MAX_PROMPT_ADAPTERS]
[–max-prompt-adapter-token MAX_PROMPT_ADAPTER_TOKEN]
[–device {auto,cuda,neuron,cpu,tpu,xpu,hpu}]
[–num-scheduler-steps NUM_SCHEDULER_STEPS]
[–use-tqdm-on-load | --no-use-tqdm-on-load]
[–multi-step-stream-outputs [MULTI_STEP_STREAM_OUTPUTS]]
[–scheduler-delay-factor SCHEDULER_DELAY_FACTOR]
[–enable-chunked-prefill [ENABLE_CHUNKED_PREFILL]]
[–speculative-config SPECULATIVE_CONFIG]
[–speculative-model SPECULATIVE_MODEL]
[–speculative-model-quantization {aqlm,awq,deepspeedfp,tpu_int8,fp8,ptpc_fp8,fbgemm_fp8,modelopt,nvfp4,marlin,gguf,gptq_marlin_24,gptq_marlin,awq_marlin,gptq,compressed-tensors,bitsandbytes,qqq,hqq,experts_int8,neuron_quant,ipex,quark,moe_wna16,None}]
[–num-speculative-tokens NUM_SPECULATIVE_TOKENS]
[–speculative-disable-mqa-scorer]
[–speculative-draft-tensor-parallel-size SPECULATIVE_DRAFT_TENSOR_PARALLEL_SIZE]
[–speculative-max-model-len SPECULATIVE_MAX_MODEL_LEN]
[–speculative-disable-by-batch-size SPECULATIVE_DISABLE_BY_BATCH_SIZE]
[–ngram-prompt-lookup-max NGRAM_PROMPT_LOOKUP_MAX]
[–ngram-prompt-lookup-min NGRAM_PROMPT_LOOKUP_MIN]
[–spec-decoding-acceptance-method {rejection_sampler,typical_acceptance_sampler}]
[–typical-acceptance-sampler-posterior-threshold TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_THRESHOLD]
[–typical-acceptance-sampler-posterior-alpha TYPICAL_ACCEPTANCE_SAMPLER_POSTERIOR_ALPHA]
[–disable-logprobs-during-spec-decoding [DISABLE_LOGPROBS_DURING_SPEC_DECODING]]
[–model-loader-extra-config MODEL_LOADER_EXTRA_CONFIG]
[–ignore-patterns IGNORE_PATTERNS]
[–preemption-mode PREEMPTION_MODE]
[–served-model-name SERVED_MODEL_NAME [SERVED_MODEL_NAME …]]
[–qlora-adapter-name-or-path QLORA_ADAPTER_NAME_OR_PATH]
[–show-hidden-metrics-for-version SHOW_HIDDEN_METRICS_FOR_VERSION]
[–otlp-traces-endpoint OTLP_TRACES_ENDPOINT]
[–collect-detailed-traces COLLECT_DETAILED_TRACES]
[–disable-async-output-proc]
[–scheduling-policy {fcfs,priority}]
[–scheduler-cls SCHEDULER_CLS]
[–override-neuron-config OVERRIDE_NEURON_CONFIG]
[–override-pooler-config OVERRIDE_POOLER_CONFIG]
[–compilation-config COMPILATION_CONFIG]
[–kv-transfer-config KV_TRANSFER_CONFIG]
[–worker-cls WORKER_CLS]
[–worker-extension-cls WORKER_EXTENSION_CLS]
[–generation-config GENERATION_CONFIG]
[–override-generation-config OVERRIDE_GENERATION_CONFIG]
[–enable-sleep-mode] [–calculate-kv-scales]
[–additional-config ADDITIONAL_CONFIG] [–enable-reasoning]
[–reasoning-parser {deepseek_r1,granite}]
[–disable-cascade-attn] [–disable-log-requests]
[–max-log-len MAX_LOG_LEN] [–disable-fastapi-docs]
[–enable-prompt-tokens-details]
[–enable-server-load-tracking]

命令参数解析:
命名参数
–host

主机名。

​–port

端口号。

默认值:8000

​–uvicorn-log-level

可选值:debug, info, warning, error, critical, trace

Uvicorn 日志级别。

默认值:“info”

​–disable-uvicorn-access-log

禁用 Uvicorn 访问日志。

默认值:False

​–allow-credentials

允许跨域凭证。

默认值:False

​–allowed-origins

允许的跨域源。

默认值:[‘*’]

​–allowed-methods

允许的 HTTP 方法。

默认值:[‘*’]

​–allowed-headers

允许的 HTTP 头。

默认值:[‘*’]

​–api-key

若指定,服务端将在请求头中验证此密钥。

​–lora-modules

LoRA 模块配置,支持 ‘name=path’ 或 JSON 格式。

旧格式示例:‘name=path’

新格式示例:{“name”: “name”, “path”: “lora_path”, “base_model_name”: “id”}

​–prompt-adapters

Prompt 适配器配置,格式为 name=path。可指定多个适配器。

​–chat-template

对话模板文件路径或单行模板字符串。

​–chat-template-content-format

可选值:auto, string, openai

消息内容渲染格式:

• “string” 按字符串渲染(示例:“Hello World”)

• “openai” 按 OpenAI 字典列表渲染(示例:[{“type”: “text”, “text”: “Hello world!”}])

默认值:“auto”

​–response-role

当 request.add_generation_prompt=true 时的默认返回角色。

默认值:assistant

​–ssl-keyfile

SSL 密钥文件路径。

​–ssl-certfile

SSL 证书文件路径。

​–ssl-ca-certs

CA 证书文件路径。

​–enable-ssl-refresh

SSL 证书变更时自动刷新上下文。

默认值:False

​–ssl-cert-reqs

客户端证书验证等级(参考 Python ssl 模块)。

默认值:0

​–root-path

反向代理路径前缀配置。

​–middleware

附加 ASGI 中间件(支持多个 --middleware 参数)。

默认值:[]

​–return-tokens-as-token-ids

当指定 --max-logprobs 时,将 token 表示为 ‘token_id:{token_id}’ 格式。

默认值:False

​–disable-frontend-multiprocessing

在模型服务进程中运行前端服务。

默认值:False

​–enable-request-id-headers

在响应中添加 X-Request-Id 头(高 QPS 时影响性能)。

默认值:False

​–enable-auto-tool-choice

启用自动工具选择(需配合 --tool-call-parser 使用)。

默认值:False

​–tool-call-parser

工具调用解析器选择(需配合 --enable-auto-tool-choice 使用)。

​–tool-parser-plugin

自定义工具解析插件注册名称。

默认值:“”

​–model

HuggingFace 模型名称或路径。

默认值:“facebook/opt-125m”

​–task

可选值:auto, generate, embedding, embed, classify, score, reward, transcription

模型任务类型。

默认值:“auto”

​–tokenizer

HuggingFace 分词器名称或路径。

​–hf-config-path

HuggingFace 配置文件路径。

​–skip-tokenizer-init

跳过分词器初始化(需自行处理 token 输入)。

默认值:False

​–revision

模型版本标识(分支/标签/commit ID)。

​–code-revision

模型代码版本标识。

​–tokenizer-revision

分词器版本标识。

​–tokenizer-mode

可选值:auto, slow, mistral, custom

分词器模式选择。

默认值:“auto”

​–trust-remote-code

信任远程代码执行。

默认值:False

​–allowed-local-media-path

允许读取本地多媒体文件的安全路径(仅限可信环境)。

​–download-dir

模型下载存储目录。

​–load-format

可选值:auto, pt, safetensors 等 14 种格式

权重加载格式。

默认值:“auto”

​–config-format

可选值:auto, hf, mistral

配置文件格式。

默认值:“ConfigFormat.AUTO”

​–dtype

可选值:auto, half, float16 等 6 种精度

模型权重和激活值精度。

默认值:“auto”

​–kv-cache-dtype

可选值:auto, fp8, fp8_e5m2, fp8_e4m3

KV 缓存精度。

默认值:“auto”

​–max-model-len

模型上下文长度(自动检测默认值)。

​–guided-decoding-backend

引导式解码后端选择(xgrammar/guidance/auto)。

默认值:“xgrammar”

​–logits-processor-pattern

日志概率处理器正则模式。

​–model-impl

可选值:auto, vllm, transformers

模型实现选择。

默认值:“auto”

​–distributed-executor-backend

可选值:ray, mp, uni, external_launcher

分布式执行后端。

默认值:“ray”

​–pipeline-parallel-size, -pp

流水线并行度。

默认值:1

​–tensor-parallel-size, -tp

张量并行度。

默认值:1

​–data-parallel-size, -dp

数据并行度。

默认值:1

​–enable-expert-parallel

启用专家并行(MoE 场景)。

默认值:False

​–max-parallel-loading-workers

大模型分批次加载参数。

​–ray-workers-use-nsight

使用 Nsight 分析 Ray 工作节点。

默认值:False

​–block-size

可选值:8, 16, 32, 64, 128

Token 块大小。

默认值:32(CUDA)/128(HPU)

​–enable-prefix-caching, --no-enable-prefix-caching

启用前缀缓存。

默认值:True

​–prefix-caching-hash-algo

可选值:builtin, sha256

前缀缓存哈希算法。

默认值:“builtin”

​–disable-sliding-window

禁用滑动窗口机制。

默认值:False

​–use-v2-block-manager

[已弃用] 强制使用 V2 块管理器。

默认值:True

​–num-lookahead-slots

前瞻槽位数(推测解码实验参数)。

默认值:0

​–seed

随机数种子。

​–swap-space

每 GPU 的 CPU 交换空间(GiB)。

默认值:4

​–cpu-offload-gb

每 GPU 的 CPU 卸载空间(GiB)。

默认值:0

​–gpu-memory-utilization

GPU 内存利用率(0-1)。

默认值:0.9

​–num-gpu-blocks-override

覆盖 GPU 块数(测试用)。

​–max-num-batched-tokens

单次批处理最大 Token 数。

​–max-num-partial-prefills

分块预填充最大并发数。

默认值:1

​–max-long-partial-prefills

长提示最大并发数。

默认值:1

​–long-prefill-token-threshold

长提示判定阈值。

默认值:0

​–max-num-seqs

单次迭代最大序列数。

​–max-logprobs

最大返回日志概率数。

默认值:20

​–disable-log-stats

禁用统计日志。

默认值:False

​–quantization, -q

可选值:aqlm, awq 等 20 种量化方法

权重量化方式。

​–rope-scaling

RoPE 缩放配置(JSON 格式)。

示例:{“rope_type”:“dynamic”,“factor”:2.0}

​–rope-theta

RoPE theta 参数。

​–hf-overrides

HuggingFace 配置覆盖(JSON 格式)。

​–enforce-eager

强制使用 Eager 模式。

默认值:False

​–max-seq-len-to-capture

CUDA 图捕获最大序列长度。

默认值:8192

​–disable-custom-all-reduce

禁用自定义 AllReduce。

默认值:False

​–tokenizer-pool-size

异步分词器池大小。

默认值:0

​–tokenizer-pool-type

分词器池类型。

默认值:“ray”

​–tokenizer-pool-extra-config

分词器池额外配置(JSON 格式)。

​–limit-mm-per-prompt

多模态输入限制(示例:image=16,video=2)。

​–mm-processor-kwargs

多模态处理器参数覆盖(JSON 格式)。

​–disable-mm-preprocessor-cache

禁用多模态预处理器缓存。

默认值:False

​–enable-lora

启用 LoRA 支持。

默认值:False

​–enable-lora-bias

启用 LoRA 偏置项。

默认值:False

​–max-loras

单批次最大 LoRA 数量。

默认值:1

​–max-lora-rank

最大 LoRA 秩。

默认值:16

​–lora-extra-vocab-size

LoRA 额外词汇量上限。

默认值:256

​–lora-dtype

可选值:auto, float16, bfloat16

LoRA 数据类型。

默认值:“auto”

​–long-lora-scaling-factors

长 LoRA 缩放因子配置。

​–max-cpu-loras

CPU 内存最大 LoRA 数量。

默认值:等于 max_loras

​–fully-sharded-loras

启用全分片 LoRA。

默认值:False

​–enable-prompt-adapter

启用 Prompt 适配器。

默认值:False

​–max-prompt-adapters

单批次最大 Prompt 适配器数量。

默认值:1

​–max-prompt-adapter-token

Prompt 适配器最大 Token 数。

默认值:0

​–device

可选值:auto, cuda, neuron 等 6 种设备

运行设备选择。

默认值:“auto”

​–num-scheduler-steps

调度器单次最大步数。

默认值:1

​–use-tqdm-on-load, --no-use-tqdm-on-load

加载进度条显示。

默认值:True

​–multi-step-stream-outputs

多步推理流式输出控制。

默认值:True

​–scheduler-delay-factor

调度延迟因子。

默认值:0.0

​–enable-chunked-prefill

启用分块预填充。

​–speculative-config

推测解码配置(JSON 格式)。

​–speculative-model

推测解码草稿模型名称。

​–speculative-model-quantization

草稿模型量化方式。

​–num-speculative-tokens

推测解码 Token 数。

​–speculative-disable-mqa-scorer

禁用 MQA 评分器。

默认值:False

​–speculative-draft-tensor-parallel-size, -spec-draft-tp

草稿模型张量并行度。

​–speculative-max-model-len

草稿模型最大序列长度。

​–speculative-disable-by-batch-size

按批次大小禁用推测解码。

​–ngram-prompt-lookup-max

N-gram 提示查找最大窗口。

​–ngram-prompt-lookup-min

N-gram 提示查找最小窗口。

​–spec-decoding-acceptance-method

可选值:rejection_sampler, typical_acceptance_sampler

推测解码验收方法。

默认值:“rejection_sampler”

​–typical-acceptance-sampler-posterior-threshold

典型采样器后验概率阈值。

默认值:0.09

​–typical-acceptance-sampler-posterior-alpha

典型采样器熵缩放因子。

默认值:0.3

​–disable-logprobs-during-spec-decoding

推测解码期间禁用日志概率。

默认值:True

​–model-loader-extra-config

模型加载器额外配置(JSON 格式)。

​–ignore-patterns

模型加载忽略模式。

默认值:[]

​–preemption-mode

抢占模式选择(recompute/swap)。

​–served-model-name

API 使用的模型名称。

​–qlora-adapter-name-or-path

QLoRA 适配器名称或路径。

​–show-hidden-metrics-for-version

显示指定版本的隐藏指标。

​–otlp-traces-endpoint

OpenTelemetry 追踪端点。

​–collect-detailed-traces

详细追踪配置(model/worker/all)。

​–disable-async-output-proc

禁用异步输出处理。

默认值:False

​–scheduling-policy

可选值:fcfs, priority

调度策略选择。

默认值:“fcfs”

​–scheduler-cls

调度器类路径。

默认值:“vllm.core.scheduler.Scheduler”

​–override-neuron-config

Neuron 设备配置覆盖(JSON 格式)。

​–override-pooler-config

池化方法配置覆盖(JSON 格式)。

​–compilation-config, -O

模型编译配置(数字等级或 JSON)。

​–kv-transfer-config

分布式 KV 缓存传输配置(JSON 格式)。

​–worker-cls

分布式工作节点类。

默认值:“auto”

​–worker-extension-cls

工作节点扩展类。

默认值:“”

​–generation-config

生成配置文件路径。

默认值:“auto”

​–override-generation-config

生成配置覆盖(JSON 格式)。

​–enable-sleep-mode

启用引擎睡眠模式(仅限 CUDA)。

默认值:False

​–calculate-kv-scales

动态计算 FP8 KV 缩放因子。

默认值:False

​–additional-config

平台特定附加配置(JSON 格式)。

​–enable-reasoning

启用推理内容生成。

默认值:False

​–reasoning-parser

可选值:deepseek_r1, granite

推理内容解析器选择。

​–disable-cascade-attn

禁用级联注意力。

默认值:False

​–disable-log-requests

禁用请求日志。

默认值:False

​–max-log-len

日志最大显示长度。

默认值:无限制

​–disable-fastapi-docs

禁用 API 文档。

默认值:False

​–enable-prompt-tokens-details

启用详细 Token 统计。

默认值:False

​–enable-server-load-tracking

启用服务负载监控。

默认值:False

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐