推理参数说明
更新时间:2026-10-26
概述
推理参数本文为您介绍 AIAK-inference 适用的推理参数详情。建议您在使用 AIAK-inference 进行模型推理加速前,先阅读本文档。
量化参数
| 参数名 | 取值类型 | 是否必选 | 默认值 | 可选值 | 描述 |
|---|---|---|---|---|---|
-i |
String | 是 | - | - | 原始模型权重输入路径。 |
-o |
String | 是 | - | - | 量化后的模型权重输出路径。 |
-quant_type |
String | 是 | - | weight_only_int8、smooth_quant、awq、gptq、squeezellm |
量化算法。 |
-tp |
Integer | 是 | - | 1、2、4、8 |
服务部署的 GPU 卡数。 |
-t |
String | 是 | - | fp16、bf16 |
指定非量化的部分存储类型。 |
-sq |
Float | 否 | Llama 默认为 0.8,GLM-130 为 0.75 |
取值范围为 0 到 1 之间的小数 |
指定 smooth_quant 的量化 smoother 参数。 |
-token |
String | 否 | - | - | 特殊需求时,指定 smooth_quant 量化需要的 token_ids 路径。 |
--multi-query-mode |
Boolean | 否 | False |
- | 是否使用 multi-query attention,适用于 smooth_quant。 |
算法模型支持
| 算法名称 | 模型支持 |
|---|---|
weight_only_int8 |
llama-7b-hf、llama-13b-hf、llama-65b-hf、llama-2-7b-hf、llama-2-13b-hf、llama-2-70b-hf、baichuan1-7b/13b |
smooth_quant |
llama-7b-hf、llama-13b-hf、llama-65b-hf、llama-2-7b-hf、llama-2-13b-hf、llama-2-70b-hf、baichuan7b、baichuan13b、qwen1.5-14b、qwen1.5-72b。非量化数据类型目前 bf16 会转换成 fp16。 |
gptq |
qwen1.5-14b、qwn1.5-72b、qwen-14b、qwen-72b |
推理参数
| 参数名 | 取值类型 | 是否必选 | 默认值 | 可选值 | 描述 |
|---|---|---|---|---|---|
--model_name |
String | 是 | - | llama、llama2、chatglm2、baichuan、glm、qwen1、qwen1.5、InternLM2-20B-chat |
用于识别模型的名称。 |
--num_gpus |
Integer | 是 | 1 |
- | 使用的 GPU 数量。 |
--ckpt_path |
String | 是 | - | - | Checkpoint 的路径。 |
--data_type |
String | 是 | - | fp16、fp32 |
数据类型。 |
--batch_size |
Integer | 否 | 8 |
- | 批处理的大小。 |
--tokenizer_path |
String | 否 | ckpt_path |
- | Tokenizer 的路径。 |
--extension_path |
String | 否 | /dev/ |
- | 扩展路径。使用默认值时,表示没有扩展。 |
--quant_mode |
String | 否 | - | weight_only_int8、smooth_quant、awq、gptq、squeezellm |
量化模式,可以不开启或启用量化。 |
--enforce_eager |
Boolean | 否 | True |
- | 强制使用 eager-mode PyTorch。默认值为 True;如果设置为 False,将混合使用 CUDA Graph 与 eager mode。 |
--gpu_memory_utilization |
Float | 否 | 0.99 |
- | 模型推理过程显存使用比例。如果开启 CUDA Graph,可能需要降低显存使用比例。 |
--grpc_port |
Integer | 否 | 8001 |
- | Triton 服务器的 gRPC 端口。 |
--http_port |
Integer | 否 | 8000 |
- | Triton 服务器的 HTTP 端口。 |
--metrics_port |
Integer | 否 | 8002 |
- | Triton 服务器的指标端口。 |
--log_verbose |
Boolean | 否 | False |
- | 如果设置为 true,则启用详细的日志记录。 |
--kv_cache_dtype |
String | 否 | auto |
auto、fp8_e5m2 |
复用 KV cache 提高推理效率。默认为 auto,表示不开启;如需开启 KV cache,请设置为 fp8_e5m2。 |
--no_prompts |
Boolean | 否 | False |
- | 输出内容可选是否包含输入的 prompt。默认为 False,输出内容包含输入的 prompt;如需过滤 prompt,请设置为 True。 |
--enable_decouple |
Boolean | 否 | True |
- | 开启流式返回。 |
--task_type |
String | 是 | causal_lm |
causal_lm、sequence_classification |
模型类型,生成式默认使用 causal_lm,判别式使用 sequence_classification。 |
--spec_dec_type |
String | 否 | none |
none、medusa |
设置投机采样模式,目前仅支持 medusa 或 none。 |
--draft_model |
String | 否 | - | - | 配合投机采样的模型路径。对于 Medusa,是训练后的模型路径。当 --spec_dec_type 不为 none 时必填。 |
--propose_cnt |
Integer | 否 | - | - | 投机采样数量,数量越大,采样命中率越高,但单次计算时间越长,可以根据业务情况调整。对于 Medusa 模式,这里是 3 个 Integer 组成的列表,推荐值为 1,3,4。当 --spec_dec_type 不为 none 时必填。 |
--max_num_seqs |
Integer | 否 | none |
正整数或 none |
在一次迭代中可以处理的最大序列数量。 |
--max_num_batched_tokens |
Integer | 否 | none |
正整数或 none |
在一次迭代中可以处理的最大 token 数量。 |
--max_model_len |
Integer | 否 | none |
正整数或 none |
序列的最大长度,包括提示和生成的文本。 |
评价此篇文章
