已合并
[Doc] API 参考文档对齐当前 CLI:参数改用规范名并对齐配置文档与文档规范 #483 #860
[Doc] API 参考文档对齐当前 CLI:参数改用规范名并对齐配置文档与文档规范 #483 #860
已合并
rookie_hongchuan创建于 14 天前
27 个文件变更+155-123
@@ -2,27 +2,27 @@
2 2 
3## 1. 功能说明3## 1. 功能说明
4 4 
5-`msmodelslim analyze` 在量化前对模型做敏感层分析,输出建议回退或重点关注的层名列表,供后续写入量化配置的 `exclude` 等字段。按分析粒度分为三个 scope:`linear`(逐个线性层)、`layer`(按层/块分组)、`attn`(Attention 模块)。分析使用校准数据集在目标设备上计算敏感度指标,并按 `--topk` 输出敏感度最高的层名(`disable_names`)。5+`msmodelslim analyze` 在量化前对模型做敏感层分析,输出建议回退或重点关注的层名列表,供后续写入量化配置的 `exclude` 等字段。按分析粒度分为三个 scope:`linear`(逐个线性层)、`layer`(按层/块分组)、`attn`(Attention 模块)。分析使用校准数据集在目标设备上计算敏感度指标,并按 `--top_k` 输出敏感度最高的层名(`disable_names`)。
6 6 
7命令边界:本命令只做分析与结果输出,不执行量化,且需要模型适配器实现分析接口。操作步骤见《[线性层敏感层分析使用指南](../../user_guide/usage_sensitive_linear_analysis.md)》、《[层级敏感层分析使用指南](../../user_guide/usage_sensitive_layer_wise_analysis.md)》、《[Attention 敏感层分析使用指南](../../user_guide/usage_sensitive_attn_analysis.md)》。7命令边界:本命令只做分析与结果输出,不执行量化,且需要模型适配器实现分析接口。操作步骤见《[线性层敏感层分析使用指南](../../user_guide/usage_sensitive_linear_analysis.md)》、《[层级敏感层分析使用指南](../../user_guide/usage_sensitive_layer_wise_analysis.md)》、《[Attention 敏感层分析使用指南](../../user_guide/usage_sensitive_attn_analysis.md)》。
8 8 
9## 2. 命令格式9## 2. 命令格式
10 10 
11```text11```text
12-msmodelslim analyze linear --model_type <model_type> --model_path <model_path> [--device <device>] [--calib_dataset <calib_dataset>] [--topk <topk>] [--trust_remote_code <True|False>] [--metrics <metrics>] [--pattern <pattern> ...]12+msmodelslim analyze linear --model_type <model_type> --model_path <model_path> [--device <device>] [--calibration_dataset <file>] [--top_k <n>] [--trust_remote_code [<BOOL>]] [--log_level <level>] [-v] [-q] [--metrics <metrics>] [--patterns <pattern> ...]
13 13 
14-msmodelslim analyze layer --model_type <model_type> --model_path <model_path> [--device <device>] [--calib_dataset <calib_dataset>] [--topk <topk>] [--trust_remote_code <True|False>] [--metrics <metrics>] [--quant_modules <module> ...]14+msmodelslim analyze layer --model_type <model_type> --model_path <model_path> [--device <device>] [--calibration_dataset <file>] [--top_k <n>] [--trust_remote_code [<BOOL>]] [--log_level <level>] [-v] [-q] [--metrics <metrics>] [--quant_modules <module> ...]
15 15 
16-msmodelslim analyze attn --model_type <model_type> --model_path <model_path> [--device <device>] [--calib_dataset <calib_dataset>] [--topk <topk>] [--trust_remote_code <True|False>] [--metrics <metrics>]16+msmodelslim analyze attn --model_type <model_type> --model_path <model_path> [--device <device>] [--calibration_dataset <file>] [--top_k <n>] [--trust_remote_code [<BOOL>]] [--log_level <level>] [-v] [-q] [--metrics <metrics>]
17```17```
18 18 
19符号说明:19符号说明:
20 20 
21- `<scope>``linear`/`layer`/`attn`)为位置参数,也是子命令名。21- `<scope>``linear`/`layer`/`attn`)为位置参数,也是子命令名。
22- 尖括号内为需替换的值,方括号内为可选参数。22- 尖括号内为需替换的值,方括号内为可选参数。
23-- `--trust_remote_code` 是显式值布尔参数,必须紧字面量 `True` `False`。23+- `--trust_remote_code` 是可选值布尔参数:不带值传入即开启(等价 `true`)跟 `true`/`false`(大小写不敏感,兼容遗留 `True`/`False`、`yes`/`no`、`on`/`off`)
24-- `--pattern`、`--quant_modules` 一次接收多个值,`...` 表示可跟多个以空格分隔的值。24+- `--patterns`、`--quant_modules` 一次接收多个值,`...` 表示可跟多个以空格分隔的值。
25-- 各 scope 的专有选项不同:`linear` 有 `--metrics`、`--pattern`;`layer` 有 `--metrics`、`--quant_modules`;`attn` 只有 `--metrics`。25+- 各 scope 的专有选项不同:`linear` 有 `--metrics`、`--patterns`;`layer` 有 `--metrics`、`--quant_modules`;`attn` 只有 `--metrics`。
26- 省略 `<scope>` 时(非帮助请求)自动按 `linear` 执行;本命令无其他位置参数。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。26- 省略 `<scope>` 时(非帮助请求)自动按 `linear` 执行;本命令无其他位置参数。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。
27 27 
28## 3. 参数列表28## 3. 参数列表
@@ -33,10 +33,13 @@ msmodelslim analyze attn --model_type <model_type> --model_path <model_path> [--
33|------|------|------|----------|-----------|--------|----------------|------|33|------|------|------|----------|-----------|--------|----------------|------|
34| `--model_type` | 无 | `string` | 单值 | 必选 | 无 | 模型类型名称,如 `Qwen2.5-7B-Instruct``Qwen-QwQ-32B` | 待分析模型类型,须与支持矩阵中的名称一致。 |34| `--model_type` | 无 | `string` | 单值 | 必选 | 无 | 模型类型名称,如 `Qwen2.5-7B-Instruct``Qwen-QwQ-32B` | 待分析模型类型,须与支持矩阵中的名称一致。 |
35| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待分析模型的权重目录。 |35| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待分析模型的权重目录。 |
36-| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu` | 运行设备类型; `msmodelslim quant --device` 不同,不支持 `npu:0,1,2,3` 这类索引列表。 |36+| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu` | 运行设备类型;本命令不提供 `--device_id`,多卡索引请通过 `msmodelslim quant`/`tune` `--device_id` 指定。 |
37-| `--calib_dataset` | 无 | `string` | 单值 | 可选 | `mix_calib.jsonl` | 可直接给文件路径,或给 `lab_calib` 目录下的文件名;后缀须为 `.json` 或 `.jsonl` | 校准数据集。 |37+| `--calibration_dataset` | 无 | `string` | 单值 | 可选 | `mix_calib.jsonl` | 可直接给文件路径,或给 `lab_calib` 目录下的文件名;后缀须为 `.json` 或 `.jsonl` | 校准数据集。 |
38-| `--topk` | 无 | `int` | 单值 | 可选 | `15` | 大于0的整数 | 输出到 `disable_names` 的最高敏感层数(经验值,仅供参考)。 |38+| `--top_k` | 无 | `int` | 单值 | 可选 | `15` | 大于0的整数 | 输出到 `disable_names` 的最高敏感层数(经验值,仅供参考)。 |
39-| `--trust_remote_code` | 无 | `bool` | 显式值(必须字面量 `True``False`) | 可选 | `False` | 字面量 `True``False`(大小写敏感) | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |39+| `--trust_remote_code` | 无 | `bool` | 可选值(不带值传入即开启,或跟 `true`/`false`) | 可选 | `false` | `true`/`false`(大小写敏感;兼容 `True`/`False`、`yes`/`no`、`on`/`off`) | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |
40+| `--log_level` | 无 | `string` | 单值 | 可选 | `info` | `debug``info``warning``error` | 日志级别。 |
41+| `-v` / `--verbose` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 提高输出详细程度(等价 `--log_level debug`)。 |
42+| `-q` / `--quiet` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 抑制非错误输出(等价 `--log_level error`)。 |
40 43 
41位置参数:44位置参数:
42 45 
@@ -49,7 +52,7 @@ msmodelslim analyze attn --model_type <model_type> --model_path <model_path> [--
49| 参数 | 别名 | 类型 | 传入形式 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 |52| 参数 | 别名 | 类型 | 传入形式 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 |
50|------|------|------|----------|-----------|--------|----------------|------|53|------|------|------|----------|-----------|--------|----------------|------|
51| `--metrics` | 无 | `string` | 单值 | 可选 | `kurtosis` | `std``quantile``kurtosis` | 线性层敏感度指标:标准差、分位数、峰度。 |54| `--metrics` | 无 | `string` | 单值 | 可选 | `kurtosis` | `std``quantile``kurtosis` | 线性层敏感度指标:标准差、分位数、峰度。 |
52-| `--pattern` | 无 | `list` | 一次接收多个值,空格分隔 | 可选 | `['*']` | 通配符模式列表 | 过滤要展示的线性层;`*` 表示全部。 |55+| `--patterns` | 无 | `list` | 一次接收多个值,空格分隔 | 可选 | `['*']` | 通配符模式列表 | 过滤要展示的线性层;`*` 表示全部。 |
53 56 
54`layer` 专有参数:57`layer` 专有参数:
55 58 
@@ -66,11 +69,11 @@ msmodelslim analyze attn --model_type <model_type> --model_path <model_path> [--
66 69 
67## 4. 参数关系70## 4. 参数关系
68 71 
69-- `scope` 决定可用的 `--metrics` 取值与专有参数;跨 scope 混用(如 `analyze attn --pattern`)会导致参数解析失败,提示不支持的参数或取值。72+- `scope` 决定可用的 `--metrics` 取值与专有参数;跨 scope 混用(如 `analyze attn --patterns`)会导致参数解析失败,提示不支持的参数或取值。
70- 省略 `scope` 时默认按 `linear` 执行;`msmodelslim analyze -h`/`--help` 时不注入 scope,展示 scope 帮助。73- 省略 `scope` 时默认按 `linear` 执行;`msmodelslim analyze -h`/`--help` 时不注入 scope,展示 scope 帮助。
71-- `--device` 仅接受 `npu`/`cpu`支持 `npu:0,1,2,3` 索引列表写法74+- `--device` 仅接受 `npu`/`cpu`;本命令提供 `--device_id`,多卡索引请通过 `msmodelslim quant`/`tune` 的 `--device_id` 指定
72-- 历史用法 `--metrics attention_mse`(省略 scope 时)会转换为 `analyze attn --metrics mse` 并丢弃 `--pattern`;该行为仅为向后兼容,命令会给出废弃提示,不推荐作为正式用法。75+- 历史用法 `--metrics attention_mse`(省略 scope 时)会转换为 `analyze attn --metrics mse` 并丢弃 `--patterns`;该行为仅为向后兼容,命令会给出废弃提示,不推荐作为正式用法。
73-- `--topk` 必须为大于0的整数;`--calib_dataset` 后缀必须为 `.json` 或 `.jsonl`。76+- `--top_k` 必须为大于0的整数;`--calibration_dataset` 后缀必须为 `.json` 或 `.jsonl`。
74 77 
75## 5. 使用示例78## 5. 使用示例
76 79 
@@ -84,7 +87,7 @@ msmodelslim analyze \
84 --model_path "${MODEL_PATH}"87 --model_path "${MODEL_PATH}"
85```88```
86 89 
87-`${MODEL_TYPE}` 为模型类型名称,`${MODEL_PATH}` 为权重目录。省略 `scope` 时默认按 `linear` 分析,使用默认指标 `kurtosis`、默认 `--topk 15` 与默认校准集 `mix_calib.jsonl`,输出敏感度最高的15个层名(`disable_names`),可写入量化 YAML 的 `exclude`。90+`${MODEL_TYPE}` 为模型类型名称,`${MODEL_PATH}` 为权重目录。省略 `scope` 时默认按 `linear` 分析,使用默认指标 `kurtosis`、默认 `--top_k 15` 与默认校准集 `mix_calib.jsonl`,输出敏感度最高的15个层名(`disable_names`),可写入量化 YAML 的 `exclude`。
88 91 
89### 5.2 指定 linear 指标与 topk92### 5.2 指定 linear 指标与 topk
90 93 
@@ -93,10 +96,10 @@ msmodelslim analyze linear \
93 --model_type "${MODEL_TYPE}" \96 --model_type "${MODEL_TYPE}" \
94 --model_path "${MODEL_PATH}" \97 --model_path "${MODEL_PATH}" \
95 --metrics kurtosis \98 --metrics kurtosis \
96- --topk 1599+ --top_k 15
97```100```
98 101 
99-显式指定 `linear` scope,使用峰度指标,并按 `--topk 15` 输出高敏感层名。102+显式指定 `linear` scope,使用峰度指标,并按 `--top_k 15` 输出高敏感层名。
100 103 
101### 5.3 Attention MSE 分析104### 5.3 Attention MSE 分析
102 105 
@@ -126,8 +129,8 @@ msmodelslim analyze layer \
126| 退出码或异常 | 含义 | 处理建议 |129| 退出码或异常 | 含义 | 处理建议 |
127|--------------|------|----------|130|--------------|------|----------|
128| `0` | 分析成功 | 按输出的层名更新量化配置(如写入 `exclude`)。 |131| `0` | 分析成功 | 按输出的层名更新量化配置(如写入 `exclude`)。 |
129-| 非 `0` | 失败 | 查看错误日志。常见原因:scope 与 `--metrics` 取值不匹配、`--device` 取值非法、`--calib_dataset` 后缀非 `.json`/`.jsonl`、`--topk` 非大于0的整数、模型适配器未实现分析接口。 |132+| 非 `0` | 失败 | 查看错误日志。常见原因:scope 与 `--metrics` 取值不匹配、`--device` 取值非法、`--calibration_dataset` 后缀非 `.json`/`.jsonl`、`--top_k` 非大于0的整数、模型适配器未实现分析接口。 |
130 133 
131## 7. 安全说明134## 7. 安全说明
132 135 
133-- `--trust_remote_code True` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。136+- `--trust_remote_code true` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。
@@ -2,56 +2,60 @@
2 2 
3## 1. 功能说明3## 1. 功能说明
4 4 
5-`msmodelslim quant` 是一键量化命令,加载原始模型权重并执行权重/激活量化,导出可部署的量化权重与描述文件。配置来源有两种:通过 `--quant_type` 按模型与量化类型自动匹配 `lab_practice` 中的最佳实践 YAML;或通过 `--config_path` 直接指定用户 YAML(支持 `modelslim_v1`、多模态以及 `modelslim_convert` 纯权重转换等协议,后者的配置可省略 `--model_type`)。两者都不传时按默认量化类型 `w8a8` 匹配最佳实践。5+`msmodelslim quant` 是一键量化命令,加载原始模型权重并执行权重/激活量化,导出可部署的量化权重与描述文件。配置来源有两种:通过 `--quant_type` 按模型与量化类型自动匹配 `lab_practice` 中的最佳实践 YAML;或通过 `--config` 直接指定用户 YAML(支持 `modelslim_v1`、多模态以及 `modelslim_convert` 纯权重转换等协议,后者的配置可省略 `--model_type`)。两者都不传时按默认量化类型 `w8a8` 匹配最佳实践。
6 6 
7-命令边界:设备支持 `npu`、`cpu` 以及 `npu:0,1,2,3` 形式的多设备索引;还支持场景标签匹配与 `--debug` 调试上下文落盘。校准数据准备与部署等操作步骤见《[一键量化完整指南](../../user_guide/usage_quick_quantization.md)》,YAML 字段说明见《[modelslim_v1 配置说明](../config/modelslim_v1.md)》等引用的配置文档。7+命令边界:设备支持 `npu`、`cpu`,多卡通过 `--device_id` 指定索引列表;还支持场景标签匹配与 `--debug` 调试上下文落盘。校准数据准备与部署等操作步骤见《[一键量化完整指南](../../user_guide/usage_quick_quantization.md)》,YAML 字段说明见《[modelslim_v1 配置说明](../config/task/modelslim_v1.md)》等引用的配置文档。
8 8 
9## 2. 命令格式9## 2. 命令格式
10 10 
11```text11```text
12-msmodelslim quant [--model_type <model_type>] --model_path <model_path> --save_path <save_path> [--device <device>] [--config_path <config_path> | --quant_type <quant_type>] [--trust_remote_code <True|False>] [--debug] [--tag <tag> ...]12+msmodelslim quant [--model_type <model_type>] --model_path <model_path> --save_path <save_path> [--device <device>] [--device_id <id> ...] [--config <config> | --quant_type <quant_type>] [--trust_remote_code [<BOOL>]] [--debug] [--tags <tag> ...] [--log_level <level>] [-v] [-q]
13```13```
14 14 
15符号说明:15符号说明:
16 16 
17- 尖括号内为需替换的值,方括号内为可选参数。17- 尖括号内为需替换的值,方括号内为可选参数。
18-- `--config_path` 与 `--quant_type` 属于互斥组,用 `|` 表示,二者不能同时传入。18+- `--config` 与 `--quant_type` 属于互斥组,用 `|` 表示,二者不能同时传入。
19-- `--trust_remote_code` 是显式值布尔参数,必须紧字面量 `True` `False`。19+- `--trust_remote_code` 是可选值布尔参数:不带值传入即开启(等价 `true`)跟 `true`/`false`(大小写不敏感,兼容遗留 `True`/`False`、`yes`/`no`、`on`/`off`)
20- `--debug` 是不带值的布尔开关。20- `--debug` 是不带值的布尔开关。
21-- `--tag` 一次接收多个值,`...` 表示可跟多个以空格分隔的值。21+- `--tags` 一次接收多个值,`...` 表示可跟多个以空格分隔的值。
22- 本命令无位置参数,全部参数通过选项传入。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。22- 本命令无位置参数,全部参数通过选项传入。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。
23 23 
24## 3. 参数列表24## 3. 参数列表
25 25 
26| 参数 | 别名 | 类型 | 传入形式 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 |26| 参数 | 别名 | 类型 | 传入形式 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 |
27|------|------|------|----------|-----------|--------|----------------|------|27|------|------|------|----------|-----------|--------|----------------|------|
28-| `--model_type` | 无 | `string` | 单值 | 条件必选(普通量化路径必选;`--config_path` 指向 `apiversion: modelslim_convert` 的配置时可省略) | 无 | 模型类型名称,如 `Qwen2.5-7B-Instruct` | 指定待量化模型类型,用于加载对应模型适配器并匹配最佳实践;仅当 `--config_path` 指向 `apiversion: modelslim_convert` 的配置时可省略。 |28+| `--model_type` | 无 | `string` | 单值 | 条件必选(普通量化路径必选;`--config` 指向 `apiversion: modelslim_convert` 的配置时可省略) | 无 | 模型类型名称,如 `Qwen2.5-7B-Instruct` | 指定待量化模型类型,用于加载对应模型适配器并匹配最佳实践;仅当 `--config` 指向 `apiversion: modelslim_convert` 的配置时可省略。 |
29| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待量化模型的权重目录。 |29| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待量化模型的权重目录。 |
30| `--save_path` | 无 | `string` | 单值 | 必选 | 无 | 输出目录(需可写) | 量化权重与描述文件的保存目录。 |30| `--save_path` | 无 | `string` | 单值 | 必选 | 无 | 输出目录(需可写) | 量化权重与描述文件的保存目录。 |
31-| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu`,或 `npu:<index>[,<index>...]`(如 `npu:0,1,2,3`);索引为逗号分隔的非负整数、不重复且小于可用设备数;`cpu` 不支持多于1个索引 | 运行设备索引列表形式在 `apiversion: modelslim_v1` 配置(含 `lab_practice` 最佳实践)下受支持。 |31+| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu` | 运行设备类型;多卡索引请用 `--device_id` 指定。 |
32-| `--config_path` | 无 | `string` | 值 | 可选 | 无 | 可读 YAML 文件路径 | 显式指定的量化配置 YAML;加载后直接采用并忽略 `--quant_type` `--tag` 的最佳实践匹配。与 `--quant_type` 互斥。 |32+| `--device_id` | 无 | `list` | 一次接收多个,空格分隔 | 可选 | 无 | 非负整数列表 `0` `0 1 2 3` | 设备索引;用于指定多个 NPU 设备。 |
33-| `--quant_type` | | `string` | 单值 | 可选 | 无(与 `--config_path` 均未提供时按 `w8a8` 匹配) | `w4a4``w4a8`、`w4a4c8`、`w4a4f8`、`w4a8c8`、`w8a16`、`w8a8`、`w8a8s`、`w8a8c8`、`w8a8f8`、`w4a4f4`、`w16a16s` | 量化类型,用于按模型与量化类型匹配最佳实践 YAML。与 `--config_path` 互斥。 |33+| `--config` | `--config_path`(遗留别名) | `string` | 单值 | 可选 | 无 | 可读 YAML 文件路径 | 显式指定的量化配置 YAML;加载后直接采用,并忽略 `--quant_type``--tags` 最佳实践匹配。与 `--quant_type` 互斥。 |
34-| `--trust_remote_code` | 无 | `bool` | 显式(必须跟字面量 `True` 或 `False`) | 可选 | `False` | 字面量 `True` `False`(大小写敏感) | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |34+| `--quant_type` | 无 | `string` | 值 | 可选 | 无(与 `--config` 均未提供时按 `w8a8` 匹配) | `w4a4`、`w4a8`、`w4a4c8`、`w4a4f8`、`w4a8c8`、`w8a16`、`w8a8`、`w8a8s`、`w8a8c8`、`w8a8f8`、`w4a4f4`、`w16a16s` | 量化类型,用于按模型与量化类型匹配最佳实践 YAML。与 `--config` 互斥。 |
35-| `--debug` | 无 | `bool` | 不带值开 | 可选 | `False` | 传入即启用 | 启用调试模式,将量化中间上下文 `save_path/debug_info/``debug_info.json``debug_info.safetensors`)。 |35+| `--trust_remote_code` | 无 | `bool` | 可选值(不带值传入即启,或跟 `true`/`false`) | 可选 | `false` | `true`/`false`(大小不敏感;兼容 `True`/`False`、`yes`/`no``on`/`off` | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |
36-| `--tag` | 无 | `list` | 一次接收多个,空格分隔 | 可选 | | 场景标签 `mindie``Atlas_A2_Inference`、`vllm` | 匹配带已验证场景标签的最佳实践;多个标签须同时出现在同一场景中,未提供硬件类型标签时自动匹配当前设备类型。 |36+| `--debug` | 无 | `bool` | 不带开关 | 可选 | `False` | 传入即启用 | 启用调试模式将量化中间上下文写入 `${SAVE_PATH}/debug_info/``debug_info.json` `debug_info.safetensors`)。 |
37+| `--tags` | `--tag`(遗留别名) | `list` | 一次接收多个值,空格分隔 | 可选 | 无 | 场景标签,如 `mindie``Atlas_A2_Inference``vllm` | 匹配带已验证场景标签的最佳实践;多个标签须同时出现在同一场景中,未提供硬件类型标签时自动匹配当前设备类型。 |
38+| `--log_level` | 无 | `string` | 单值 | 可选 | `info` | `debug``info``warning``error` | 日志级别。 |
39+| `-v` / `--verbose` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 提高输出详细程度(等价 `--log_level debug`)。 |
40+| `-q` / `--quiet` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 抑制非错误输出(等价 `--log_level error`)。 |
37 41 
38## 4. 参数关系42## 4. 参数关系
39 43 
40-- `--config_path` 与 `--quant_type` 互斥,同时传入会报错。44+- `--config` 与 `--quant_type` 互斥,同时传入会报错。
41- 两者都不传时,按默认量化类型 `w8a8` 匹配最佳实践;未匹配到最佳实践时会给出提示并等待确认(输入 `y` 继续,否则退出)。45- 两者都不传时,按默认量化类型 `w8a8` 匹配最佳实践;未匹配到最佳实践时会给出提示并等待确认(输入 `y` 继续,否则退出)。
42-- 指定 `--config_path` 后直接采用该配置,`--quant_type` 与 `--tag` 的最佳实践匹配均被忽略。46+- 指定 `--config` 后直接采用该配置,`--quant_type` 与 `--tags` 的最佳实践匹配均被忽略。
43-- `--model_type` 在普通量化路径下必须提供;仅当 `--config_path` 指向 `apiversion: modelslim_convert` 的配置时可省略。47+- `--model_type` 在普通量化路径下必须提供;仅当 `--config` 指向 `apiversion: modelslim_convert` 的配置时可省略。
44-- `--tag` 指定多个值时须同时出现在同一已验证场景;未提供硬件类型标签时自动匹配当前设备类型。48+- `--tags` 指定多个值时须同时出现在同一已验证场景;未提供硬件类型标签时自动匹配当前设备类型。
45-- `--debug` 启用后量化上下文写入 `save_path/debug_info/`。49+- `--debug` 启用后量化上下文写入 `${SAVE_PATH}/debug_info/`。
46 50 
47## 5. 引用的配置51## 5. 引用的配置
48 52 
49| 关联参数 | 配置名称 | 引用关系 | 配置文档 |53| 关联参数 | 配置名称 | 引用关系 | 配置文档 |
50|----------|----------|----------|----------|54|----------|----------|----------|----------|
51-| `--config_path` | `modelslim_v1` | 加载整份量化 YAML | 《[modelslim_v1 配置说明](../config/modelslim_v1.md)》 |55+| `--config` | `modelslim_v1` | 加载整份量化 YAML | 《[modelslim_v1 配置说明](../config/task/modelslim_v1.md)》 |
52-| `--config_path` | `multimodal_vlm_modelslim_v1` | 多模态理解模型量化 YAML | 《[multimodal_vlm_modelslim_v1 配置说明](../config/multimodal_vlm_modelslim_v1.md)》 |56+| `--config` | `multimodal_vlm_modelslim_v1` | 多模态理解模型量化 YAML | 《[multimodal_vlm_modelslim_v1 配置说明](../config/task/multimodal_vlm_modelslim_v1.md)》 |
53-| `--config_path` | `multimodal_sd_modelslim_v1` | 多模态生成模型量化 YAML | 《[multimodal_sd_modelslim_v1 配置说明](../config/multimodal_sd_modelslim_v1.md)》 |57+| `--config` | `multimodal_sd_modelslim_v1` | 多模态生成模型量化 YAML | 《[multimodal_sd_modelslim_v1 配置说明](../config/task/multimodal_sd_modelslim_v1.md)》 |
54-| `--config_path` | `modelslim_convert` | 纯权重转换协议 YAML,可省略 `--model_type` | 《[modelslim_convert 配置说明](../config/modelslim_convert.md)》 |58+| `--config` | `modelslim_convert` | 纯权重转换协议 YAML,可省略 `--model_type` | 《[modelslim_convert 配置说明](../config/task/modelslim_convert.md)》 |
55| `--quant_type` | `lab_practice` 最佳实践 YAML | 按模型与量化类型匹配 | 《[一键量化完整指南](../../user_guide/usage_quick_quantization.md)》 |59| `--quant_type` | `lab_practice` 最佳实践 YAML | 按模型与量化类型匹配 | 《[一键量化完整指南](../../user_guide/usage_quick_quantization.md)》 |
56 60 
57## 6. 环境变量61## 6. 环境变量
@@ -74,7 +78,7 @@ msmodelslim quant \
74 --save_path "${SAVE_PATH}"78 --save_path "${SAVE_PATH}"
75```79```
76 80 
77-`${MODEL_TYPE}` 为模型类型名称(如 `Qwen2.5-7B-Instruct`),`${MODEL_PATH}` 为浮点权重目录,`${SAVE_PATH}` 为量化输出目录。未指定 `--quant_type` 与 `--config_path` 时,默认按量化类型 `w8a8` 匹配最佳实践并执行量化;若模型加载需要模型目录内的自定义代码,再补充 `--trust_remote_code True`。81+`${MODEL_TYPE}` 为模型类型名称(如 `Qwen2.5-7B-Instruct`),`${MODEL_PATH}` 为浮点权重目录,`${SAVE_PATH}` 为量化输出目录。未指定 `--quant_type` 与 `--config` 时,默认按量化类型 `w8a8` 匹配最佳实践并执行量化;若模型加载需要模型目录内的自定义代码,再补充 `--trust_remote_code true`。
78 82 
79### 7.2 显式指定量化类型与设备83### 7.2 显式指定量化类型与设备
80 84 
@@ -84,10 +88,11 @@ msmodelslim quant \
84 --model_path "${MODEL_PATH}" \88 --model_path "${MODEL_PATH}" \
85 --save_path "${SAVE_PATH}" \89 --save_path "${SAVE_PATH}" \
86 --quant_type w8a8c8 \90 --quant_type w8a8c8 \
87- --device npu:0,1,2,391+ --device npu \
92+ --device_id 0 1 2 3
88```93```
89 94 
90-`--quant_type w8a8c8` 表示权重8bit、激活8bit、KVCache 8bit 量化;`--device npu:0,1,2,3` 使用4个 NPU 设备索引列表形式在 `apiversion: modelslim_v1` 配置(含 `lab_practice` 最佳实践)下受支持。95+`--quant_type w8a8c8` 表示权重8bit、激活8bit、KVCache 8bit 量化;`--device_id 0 1 2 3` 使用4个 NPU 设备索引列表形式在 `apiversion: modelslim_v1` 配置下受支持
91 96 
92### 7.3 使用自定义配置文件97### 7.3 使用自定义配置文件
93 98 
@@ -96,7 +101,7 @@ msmodelslim quant \
96 --model_type "${MODEL_TYPE}" \101 --model_type "${MODEL_TYPE}" \
97 --model_path "${MODEL_PATH}" \102 --model_path "${MODEL_PATH}" \
98 --save_path "${SAVE_PATH}" \103 --save_path "${SAVE_PATH}" \
99- --config_path "${CONFIG_PATH}"104+ --config "${CONFIG_PATH}"
100```105```
101 106 
102`${CONFIG_PATH}` 指向符合 V1 等协议的量化 YAML;指定后直接采用该配置,不再做最佳实践匹配。字段说明见引用的配置文档。107`${CONFIG_PATH}` 指向符合 V1 等协议的量化 YAML;指定后直接采用该配置,不再做最佳实践匹配。字段说明见引用的配置文档。
@@ -109,20 +114,20 @@ msmodelslim quant \
109 --model_path "${MODEL_PATH}" \114 --model_path "${MODEL_PATH}" \
110 --save_path "${SAVE_PATH}" \115 --save_path "${SAVE_PATH}" \
111 --quant_type w8a8 \116 --quant_type w8a8 \
112- --tag mindie Atlas_A2_Inference117+ --tags mindie Atlas_A2_Inference
113```118```
114 119 
115-`--tag` 后的多个标签须同时出现在同一已验证场景中;未精确匹配时命令会给出提示并等待确认(输入 `y` 继续,否则退出);命中备用(standby)配置时提示改用备用配置,仍需用户确认。120+`--tags` 后的多个标签须同时出现在同一已验证场景中;未精确匹配时命令会给出提示并等待确认(输入 `y` 继续,否则退出);命中备用(standby)配置时提示改用备用配置,仍需用户确认。
116 121 
117## 8. 退出码与异常处理122## 8. 退出码与异常处理
118 123 
119| 退出码或异常 | 含义 | 处理建议 |124| 退出码或异常 | 含义 | 处理建议 |
120|--------------|------|----------|125|--------------|------|----------|
121| `0` | 量化成功 | 检查 `${SAVE_PATH}` 是否生成量化权重与描述文件。 |126| `0` | 量化成功 | 检查 `${SAVE_PATH}` 是否生成量化权重与描述文件。 |
122-| 非 `0` | 失败 | 查看错误日志。常见原因:`--config_path` 与 `--quant_type` 同时传入、普通量化路径缺少 `--model_type`、YAML 校验失败、设备索引非法或超出可用设备。 |127+| 非 `0` | 失败 | 查看错误日志。常见原因:`--config` 与 `--quant_type` 同时传入、普通量化路径缺少 `--model_type`、YAML 校验失败、`--device_id` 索引非法或超出可用设备。 |
123 128 
124## 9. 安全说明129## 9. 安全说明
125 130 
126-- `--trust_remote_code True` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。131+- `--trust_remote_code true` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。
127- `--save_path` 会写入量化结果文件;请确认目录可写且不会覆盖非预期数据。132- `--save_path` 会写入量化结果文件;请确认目录可写且不会覆盖非预期数据。
128-- `--debug` 会把量化中间上下文(含张量数据)写入 `save_path/debug_info/`,请按组织安全策略管理该目录。133+- `--debug` 会把量化中间上下文(含张量数据)写入 `${SAVE_PATH}/debug_info/`,请按组织安全策略管理该目录。
@@ -9,16 +9,16 @@
9## 2. 命令格式9## 2. 命令格式
10 10 
11```text11```text
12-msmodelslim tune --model_path <model_path> --save_path <save_path> --config <config> [--model_type <model_type>] [--device <device>] [--timeout <timeout>] [--trust_remote_code <True|False>]12+msmodelslim tune --model_path <model_path> --save_path <save_path> --config <config> [--model_type <model_type>] [--device <device>] [--device_id <id> ...] [--timeout <timeout>] [--trust_remote_code [<BOOL>]] [--log_level <level>] [-v] [-q]
13```13```
14 14 
15符号说明:15符号说明:
16 16 
17- 尖括号内为需替换的值,方括号内为可选参数。17- 尖括号内为需替换的值,方括号内为可选参数。
18- `--model_path``--save_path``--config` 为必选参数。18- `--model_path``--save_path``--config` 为必选参数。
19-- `--config` 是调优 YAML 路径与一键量化的 `--config_path` 不同一参数19+- `--config` 是必选的调优 YAML 路径与一键量化命令的 `--config` 同名,但语义不同键量化的 `--config` 可选)
20- `--timeout` 为时长字符串,如 `2H``3D4H`20- `--timeout` 为时长字符串,如 `2H``3D4H`
21-- `--trust_remote_code` 是显式值布尔参数,必须紧字面量 `True` `False`。21+- `--trust_remote_code` 是可选值布尔参数:不带值传入即开启(等价 `true`)跟 `true`/`false`(大小写不敏感,兼容遗留 `True`/`False`、`yes`/`no`、`on`/`off`)
22- 本命令无位置参数。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。22- 本命令无位置参数。本语法摘要用于说明参数结构,不作为可复制命令;可复制命令见「使用示例」。
23 23 
24## 3. 参数列表24## 3. 参数列表
@@ -29,15 +29,19 @@ msmodelslim tune --model_path <model_path> --save_path <save_path> --config <con
29| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待调优模型的权重目录。 |29| `--model_path` | 无 | `string` | 单值 | 必选 | 无 | 原始模型权重目录(需存在且可读) | 待调优模型的权重目录。 |
30| `--save_path` | 无 | `string` | 单值 | 必选 | 无 | 输出目录(需可写) | 调优结果、量化模型与历史记录的保存目录。 |30| `--save_path` | 无 | `string` | 单值 | 必选 | 无 | 输出目录(需可写) | 调优结果、量化模型与历史记录的保存目录。 |
31| `--config` | 无 | `string` | 单值 | 必选 | 无 | 可读 YAML 文件路径 | 调优配置 YAML,含 `strategy``evaluation` 字段。 |31| `--config` | 无 | `string` | 单值 | 必选 | 无 | 可读 YAML 文件路径 | 调优配置 YAML,含 `strategy``evaluation` 字段。 |
32-| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu`,或 `npu:<index>[,<index>...]`(如 `npu:0,1,2,3`) | 运行设备多卡索引写法与 `msmodelslim quant --device` 约束相同。 |32+| `--device` | 无 | `string` | 单值 | 可选 | `npu` | `npu`、`cpu` | 运行设备类型;多卡索引请用 `--device_id` 指定。 |
33+| `--device_id` | 无 | `list` | 一次接收多个值,空格分隔 | 可选 | 无 | 非负整数列表,如 `0``0 1 2 3` | 设备索引,用于指定多个 NPU 设备。 |
33| `--timeout` | 无 | `string` | 单值 | 可选 | 无(不限时) | 形如 `1D2H30M15S`,单位固定顺序 D/H/M/S,可省略任意一段(如 `1D2H``30M``10S`),至少含一个单位,字母大写 | 调优墙钟超时;到达超时时间后停止本次调优。 |34| `--timeout` | 无 | `string` | 单值 | 可选 | 无(不限时) | 形如 `1D2H30M15S`,单位固定顺序 D/H/M/S,可省略任意一段(如 `1D2H``30M``10S`),至少含一个单位,字母大写 | 调优墙钟超时;到达超时时间后停止本次调优。 |
34-| `--trust_remote_code` | 无 | `bool` | 显式值(必须字面量 `True``False`) | 可选 | `False` | 字面量 `True``False`(大小写敏感) | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |35+| `--trust_remote_code` | 无 | `bool` | 可选值(不带值传入即开启,或跟 `true`/`false`) | 可选 | `false` | `true`/`false`(大小写敏感;兼容 `True`/`False`、`yes`/`no`、`on`/`off`) | 是否信任并执行模型目录中的自定义 Python 代码;仅在确认代码来源可信时开启。 |
36+| `--log_level` | 无 | `string` | 单值 | 可选 | `info` | `debug``info``warning``error` | 日志级别。 |
37+| `-v` / `--verbose` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 提高输出详细程度(等价 `--log_level debug`)。 |
38+| `-q` / `--quiet` | 无 | `bool` | 不带值开关 | 可选 | 关闭 | 传入即启用 | 抑制非错误输出(等价 `--log_level error`)。 |
35 39 
36## 4. 参数关系40## 4. 参数关系
37 41 
38-- 本命令通过 `--config` 加载调优 YAML与一键量化的 `--config_path` 不一参数;本命令 `--config`。42+- 本命令通过必选的 `--config` 加载调优 YAML与一键量化命令的 `--config` 同名但语义不同本命令 `--config_path`。
39- `--timeout` 未设置时不限制调优墙钟时间;设置后超时即停止当前调优。43- `--timeout` 未设置时不限制调优墙钟时间;设置后超时即停止当前调优。
40-- `--device` 多卡索引写法的约束与 `msmodelslim quant --device` 相同44+- `--device` 仅接受 `npu`/`cpu`,多卡索引通过 `--device_id` 指定
41- `--model_type` 不传时使用默认值 `default`45- `--model_type` 不传时使用默认值 `default`
42 46 
43## 5. 引用的配置47## 5. 引用的配置
@@ -77,10 +81,11 @@ msmodelslim tune \
77 --save_path "${SAVE_PATH}" \81 --save_path "${SAVE_PATH}" \
78 --config "${CONFIG_PATH}" \82 --config "${CONFIG_PATH}" \
79 --timeout 2H \83 --timeout 2H \
80- --device npu:0,1,2,384+ --device npu \
85+ --device_id 0 1 2 3
81```86```
82 87 
83-`--timeout 2H` 表示最多运行2小时;`--device npu:0,1,2,3` 使用4个 NPU 设备。88+`--timeout 2H` 表示最多运行2H;`--device_id 0 1 2 3` 使用4个 NPU 设备。
84 89 
85## 8. 退出码与异常处理90## 8. 退出码与异常处理
86 91 
@@ -91,5 +96,5 @@ msmodelslim tune \
91 96 
92## 9. 安全说明97## 9. 安全说明
93 98 
94-- `--trust_remote_code True` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。99+- `--trust_remote_code true` 会执行模型目录中的自定义 Python 代码,仅在确认来源可信时开启。
95- `--save_path` 会写入调优结果与历史记录;请确认目录可写且不会覆盖非预期数据。100- `--save_path` 会写入调优结果与历史记录;请确认目录可写且不会覆盖非预期数据。
@@ -3,7 +3,7 @@
3 3 
4## 1. 配置概述4## 1. 配置概述
5 5 
6-二值(有/无量化)敏感分析处理器配置。6+二值(有/无量化)敏感分析处理器配置。
7 7 
8| 项目 | 内容 |8| 项目 | 内容 |
9|------|------|9|------|------|
@@ -32,9 +32,9 @@
32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》
33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》
34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》
35-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 本页 <a href="#2-1-binary-analysis">§2.1</a>35+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 本页 <a href="#2-1-binary-analysis">§2.1</a>
36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》
37-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》37+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》
38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》
39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》
40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》
@@ -53,7 +53,7 @@
53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》
54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》
55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》
56-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》56+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》
57 57 
58## 3. 完整配置参考58## 3. 完整配置参考
59 59 
@@ -32,9 +32,9 @@
32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》
33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》
34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》
35-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》35+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》
36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 本页 <a href="#2-1-binary-operator-layer-wise">§2.1</a>36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 本页 <a href="#2-1-binary-operator-layer-wise">§2.1</a>
37-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》37+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》
38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》
39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》
40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》
@@ -53,7 +53,7 @@
53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》
54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》
55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》
56-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》56+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》
57 57 
58## 3. 完整配置参考58## 3. 完整配置参考
59 59 
@@ -3,7 +3,7 @@
3 3 
4## 1. 配置概述4## 1. 配置概述
5 5 
6-模型级敏感分析配置(对比模型最终输出,使用 MSE 指标)6+模型级敏感分析配置(对比模型最终输出,使用 MSE 指标)
7 7 
8| 项目 | 内容 |8| 项目 | 内容 |
9|------|------|9|------|------|
@@ -18,7 +18,7 @@
18|----------|------|-----------|--------|----------------|------|----------|18|----------|------|-----------|--------|----------------|------|----------|
19| `type` | `string` | 可选 | `binary_operator_model_wise` | `binary_operator_model_wise` | 处理器类型,固定为 `binary_operator_model_wise`。 | 无 |19| `type` | `string` | 可选 | `binary_operator_model_wise` | `binary_operator_model_wise` | 处理器类型,固定为 `binary_operator_model_wise`。 | 无 |
20| `metrics` | `string` | 可选 | `mse_model_wise` | — | 分析指标:`mse_model_wise`(对比模型最终输出) | 无 |20| `metrics` | `string` | 可选 | `mse_model_wise` | — | 分析指标:`mse_model_wise`(对比模型最终输出) | 无 |
21-| `quant_modules` | `list[string]` | 可选 | `['*']` | — | 与 linear_quant.include、CLI --quant_modules 一致(YAML 占位 ${quant_modules});用于层敏感结果展示名后缀,如 model.layers.2 (*mlp*)。实际量化范围以 linear_quant 为准。 | 无 |21+| `quant_modules` | `list[string]` | 可选 | `['*']` | — | 与 linear_quant.include、CLI --quant_modules 一致;用于结果展示名后缀,如 model.layers.2 (*mlp*)。实际量化范围以 linear_quant 为准。 | 无 |
22| `configs` | `list[object]` | 可选 | `[]` | — | 量化子处理器配置列表,用于进行量化-反量化 | 本页 <a href="#2-2-autoprocessorconfig">§2.2</a> |22| `configs` | `list[object]` | 可选 | `[]` | — | 量化子处理器配置列表,用于进行量化-反量化 | 本页 <a href="#2-2-autoprocessorconfig">§2.2</a> |
23 23 
24**配置约束**24**配置约束**
@@ -32,9 +32,9 @@
32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》
33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》
34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》
35-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》35+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》
36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》
37-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 本页 <a href="#2-1-binary-operator-model-wise">§2.1</a>37+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 本页 <a href="#2-1-binary-operator-model-wise">§2.1</a>
38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》
39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》
40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》
@@ -53,7 +53,7 @@
53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》
54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》
55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》
56-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》56+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》
57 57 
58## 3. 完整配置参考58## 3. 完整配置参考
59 59 
@@ -30,9 +30,9 @@
30- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》30- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](adapt_rotation.md)》
31- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》31- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](autoround_quant.md)》
32- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》32- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](awq.md)》
33-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》33+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](binary_analysis.md)》
34- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》34- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](binary_operator_layer_wise.md)》
35-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》35+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](binary_operator_model_wise.md)》
36- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》36- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](dynamic_cache.md)》
37- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》37- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](fa3_quant.md)》
38- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》38- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](flatquant.md)》
@@ -51,7 +51,7 @@
51- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》51- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](smooth_quant.md)》
52- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》52- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](svd_res.md)》
53- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》53- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](trainable_linear_quant.md)》
54-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》54+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](unary_analysis.md)》
55 55 
56## 3. 完整配置参考56## 3. 完整配置参考
57 57 
@@ -18,7 +18,7 @@
18|----------|------|-----------|--------|----------------|------|----------|18|----------|------|-----------|--------|----------------|------|----------|
19| `type` | `string` | 可选 | `trainable_linear_quant` | `trainable_linear_quant` | 处理器类型,固定为 `trainable_linear_quant`。 | 无 |19| `type` | `string` | 可选 | `trainable_linear_quant` | `trainable_linear_quant` | 处理器类型,固定为 `trainable_linear_quant`。 | 无 |
20| `operations` | `list[object]` | 可选 | `[MinmaxTuneOpConfig(type='minmax_tune', lr=None), RoundTuneOpConfig(type='round_tune', lr=None)]` | 最少1项 | 可训练量化管线 OP 配置列表;每项含 type,其余字段由各插件定义 | 本页 <a href="#2-2-tlq-op-config">§2.2</a> |20| `operations` | `list[object]` | 可选 | `[MinmaxTuneOpConfig(type='minmax_tune', lr=None), RoundTuneOpConfig(type='round_tune', lr=None)]` | 最少1项 | 可训练量化管线 OP 配置列表;每项含 type,其余字段由各插件定义 | 本页 <a href="#2-2-tlq-op-config">§2.2</a> |
21-| `strategies` | `list[object]` | 可选 | `[]` | 最少1项 | 量化策略配置列表;未提供时为空列表,不应用量化策略;若显式提供则至少 1 项。 | 本页 <a href="#2-6-tlq-quant-strategy-config">§2.6</a> |21+| `strategies` | `list[object]` | 可选 | `[]` | 0项或≥1项 | 量化策略配置列表;未提供时为空列表,不应用量化策略;若显式提供则至少1项。 | 本页 <a href="#2-6-tlq-quant-strategy-config">§2.6</a> |
22| `train_with_act_quant` | `bool` | 可选 | `false` | — | 块级训练前向是否对激活做伪量化(经 x_kernel);false 与 autoround 的 train_with_act_quant=False 一致;导出 IR 仍由 qconfig.act 决定,不受此项影响 | 无 |22| `train_with_act_quant` | `bool` | 可选 | `false` | — | 块级训练前向是否对激活做伪量化(经 x_kernel);false 与 autoround 的 train_with_act_quant=False 一致;导出 IR 仍由 qconfig.act 决定,不受此项影响 | 无 |
23| `enable_quanted_input` | `bool` | 可选 | `false` | — | 是否将本层量化前向结果作为下一层训练/量化传播的旁路输入(q_input);不影响浮点 teacher:Runner 层间 datas 始终传递 teacher 输出 | 无 |23| `enable_quanted_input` | `bool` | 可选 | `false` | — | 是否将本层量化前向结果作为下一层训练/量化传播的旁路输入(q_input);不影响浮点 teacher:Runner 层间 datas 始终传递 teacher 输出 | 无 |
24| `train_config` | `object` | 可选 | 见嵌套配置默认值 | — | 块级 Trainer 超参:iters、gradient_accumulate_steps、select_best、lr(或 learning_rate)、loss_type;各 OP 可单独配置 lr 覆盖全局值 | 本页 <a href="#2-9-block-train-config">§2.9</a> |24| `train_config` | `object` | 可选 | 见嵌套配置默认值 | — | 块级 Trainer 超参:iters、gradient_accumulate_steps、select_best、lr(或 learning_rate)、loss_type;各 OP 可单独配置 lr 覆盖全局值 | 本页 <a href="#2-9-block-train-config">§2.9</a> |
@@ -32,7 +32,7 @@
32| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |32| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
33|----------|------|-----------|--------|----------------|------|----------|33|----------|------|-----------|--------|----------------|------|----------|
34| `type` | `string` | 必选 | 无 | — | 算子类型,分派具体 TLQ 算子(如 `minmax_tune``round_tune`)。 | 无 |34| `type` | `string` | 必选 | 无 | — | 算子类型,分派具体 TLQ 算子(如 `minmax_tune``round_tune`)。 | 无 |
35-| `lr` | `float / null` | 可选 | `null` | >0.0 | 该 Op 可训练参数学习率;未指定时使用 train_config.lr | 无 |35+| `lr` | `float / null` | 可选 | `null` | >0.0;或 null | 该 Op 可训练参数学习率;未指定时使用 train_config.lr | 无 |
36 36 
37**配置约束**37**配置约束**
38 38 
@@ -49,7 +49,7 @@
49| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |49| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
50|----------|------|-----------|--------|----------------|------|----------|50|----------|------|-----------|--------|----------------|------|----------|
51| `type` | `string` | 可选 | `minmax_tune` | `minmax_tune` | 插件类型:minmax_tune | 无 |51| `type` | `string` | 可选 | `minmax_tune` | `minmax_tune` | 插件类型:minmax_tune | 无 |
52-| `lr` | `float / null` | 可选 | `null` | >0.0 | — | 无 |52+| `lr` | `float / null` | 可选 | `null` | >0.0;或 null | — | 无 |
53 53 
54**配置约束**54**配置约束**
55 55 
@@ -60,7 +60,7 @@
60| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |60| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
61|----------|------|-----------|--------|----------------|------|----------|61|----------|------|-----------|--------|----------------|------|----------|
62| `type` | `string` | 可选 | `round_tune` | `round_tune` | 插件类型:round_tune | 无 |62| `type` | `string` | 可选 | `round_tune` | `round_tune` | 插件类型:round_tune | 无 |
63-| `lr` | `float / null` | 可选 | `null` | >0.0 | — | 无 |63+| `lr` | `float / null` | 可选 | `null` | >0.0;或 null | — | 无 |
64 64 
65**配置约束**65**配置约束**
66 66 
@@ -71,7 +71,7 @@
71| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |71| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
72|----------|------|-----------|--------|----------------|------|----------|72|----------|------|-----------|--------|----------------|------|----------|
73| `type` | `string` | 可选 | `trainable_smooth` | `trainable_smooth` | 插件类型:trainable_smooth | 无 |73| `type` | `string` | 可选 | `trainable_smooth` | `trainable_smooth` | 插件类型:trainable_smooth | 无 |
74-| `lr` | `float / null` | 可选 | `null` | >0.0 | — | 无 |74+| `lr` | `float / null` | 可选 | `null` | >0.0;或 null | — | 无 |
75| `enable_subgraph_type` | `list[string]` | 可选 | `['norm-linear', 'linear-linear', 'ov', 'up-down', 'non-fusion']` | — | 启用的 Smooth 子图类型,须为 SMOOTH_SUPPORTED_SUBGRAPH_TYPES 子集 | 无 |75| `enable_subgraph_type` | `list[string]` | 可选 | `['norm-linear', 'linear-linear', 'ov', 'up-down', 'non-fusion']` | — | 启用的 Smooth 子图类型,须为 SMOOTH_SUPPORTED_SUBGRAPH_TYPES 子集 | 无 |
76| `include` | `list[string] / null` | 可选 | `null` | — | 子图入口 include 通配 | 无 |76| `include` | `list[string] / null` | 可选 | `null` | — | 子图入口 include 通配 | 无 |
77| `exclude` | `list[string] / null` | 可选 | `null` | — | 子图入口 exclude 通配 | 无 |77| `exclude` | `list[string] / null` | 可选 | `null` | — | 子图入口 exclude 通配 | 无 |
@@ -131,7 +131,7 @@ trainable_linear_quant 量化策略:对匹配的线性层应用一组可训练
131|----------|------|-----------|--------|----------------|------|----------|131|----------|------|-----------|--------|----------------|------|----------|
132| `iters` | `int` | 可选 | `50` | ≥0 | 块级训练迭代次数;为 0 时 Trainer 跳过优化 | 无 |132| `iters` | `int` | 可选 | `50` | ≥0 | 块级训练迭代次数;为 0 时 Trainer 跳过优化 | 无 |
133| `gradient_accumulate_steps` | `int` | 可选 | `8` | ≥1 | 梯度累加步数,用于在有限显存下调节等效 batch | 无 |133| `gradient_accumulate_steps` | `int` | 可选 | `8` | ≥1 | 梯度累加步数,用于在有限显存下调节等效 batch | 无 |
134-| `lr` | `float` | 可选 | `0.01` | >0.0 | 全局基础学习率 | 无 |134+| `lr` | `float` | 可选 | `0.01` | >0.0 | 全局基础学习率(别名 `learning_rate`) | 无 |
135| `select_best` | `object` | 可选 | 见嵌套配置默认值 | — | 最优 iter 快照策略(按 mode 区分字段:ema / min_loss / last) | 本页 <a href="#2-10-selectbestconfig">§2.10</a> |135| `select_best` | `object` | 可选 | 见嵌套配置默认值 | — | 最优 iter 快照策略(按 mode 区分字段:ema / min_loss / last) | 本页 <a href="#2-10-selectbestconfig">§2.10</a> |
136| `loss_type` | `string` | 可选 | `l1` | `l1``custom_outlier` | 块级训练损失:l1(L1Loss reduction=none)、custom_outlier(0.3*全量 L1 + 0.7*3σ 内区域 L1) | 无 |136| `loss_type` | `string` | 可选 | `l1` | `l1``custom_outlier` | 块级训练损失:l1(L1Loss reduction=none)、custom_outlier(0.3*全量 L1 + 0.7*3σ 内区域 L1) | 无 |
137| `train_seed` | `int` | 可选 | `42` | — | 块级训练随机种子(用于 sample 打乱与确定性算子) | 无 |137| `train_seed` | `int` | 可选 | `42` | — | 块级训练随机种子(用于 sample 打乱与确定性算子) | 无 |
@@ -3,7 +3,7 @@
3 3 
4## 1. 配置概述4## 1. 配置概述
5 5 
6-一元(无量化)敏感分析处理器配置。6+一元(无量化)敏感分析处理器配置。
7 7 
8| 项目 | 内容 |8| 项目 | 内容 |
9|------|------|9|------|------|
@@ -151,7 +151,7 @@
151|----------|------|-----------|--------|----------------|------|----------|151|----------|------|-----------|--------|----------------|------|----------|
152| `src_format` | `string` | 可选 | `auto` | — | 源权重格式;`auto` 由模型适配器/权重目录自动推断。 | 无 |152| `src_format` | `string` | 可选 | `auto` | — | 源权重格式;`auto` 由模型适配器/权重目录自动推断。 | 无 |
153| `dst_format` | `string` | 可选 | `ascendv1` | — | 目标保存格式:`ascendv1`(昇腾,与 `SaveConfig.type``ascend_v1` 等价);`compressed_tensors`(HF 兼容 safetensors);`huggingface`/`hf``compressed_tensors` 的别名。 | 无 |153| `dst_format` | `string` | 可选 | `ascendv1` | — | 目标保存格式:`ascendv1`(昇腾,与 `SaveConfig.type``ascend_v1` 等价);`compressed_tensors`(HF 兼容 safetensors);`huggingface`/`hf``compressed_tensors` 的别名。 | 无 |
154-| `dst_ir` | `string / null` | 可选 | `null` | `FLOAT`、`FP8_BLOCK`、`W8A8_MXFP8`、`W4A4_MXFP4`、`W4A8_MXFP8`、`INT4_PACKED`、`NVFP4_MODELOPT`、`HIFP4`、`UNKNOWN` | 目标 IR 类型;不设置时由目标格式决定。 | 无 |154+| `dst_ir` | `string / null` | 可选 | `null` | `FLOAT`、`FP8_BLOCK`、`W8A8_MXFP8`、`W4A4_MXFP4`、`W4A8_MXFP8`、`INT4_PACKED`、`NVFP4_MODELOPT`、`HIFP4`、`UNKNOWN`;或 null | 目标 IR 类型;不设置时由目标格式决定。 | 无 |
155 155 
156**配置约束**156**配置约束**
157 157 
@@ -59,9 +59,9 @@
59- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》59- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》
60- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》60- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》
61- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》61- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》
62-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》62+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》
63- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》63- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》
64-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》64+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》
65- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》65- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》
66- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》66- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》
67- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》67- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》
@@ -80,7 +80,7 @@
80- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》80- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》
81- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》81- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》
82- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》82- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》
83-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》83+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》
84 84 
85<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>85<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>
86 86 
@@ -32,7 +32,7 @@
32| `runner` | `string` | 可选 | `layer_wise` | `auto``model_wise``layer_wise``dp_layer_wise` | 流水线执行方式:`layer_wise` 逐层计算(默认)、`auto` 按设备数量自动选择、`model_wise` 整模型计算、`dp_layer_wise` 数据并行逐层计算。 | 无 |32| `runner` | `string` | 可选 | `layer_wise` | `auto``model_wise``layer_wise``dp_layer_wise` | 流水线执行方式:`layer_wise` 逐层计算(默认)、`auto` 按设备数量自动选择、`model_wise` 整模型计算、`dp_layer_wise` 数据并行逐层计算。 | 无 |
33| `prior` | `list[object]` | 可选 | `[]` | — | 前置阶段列表,每阶段含 process 与 dataset | 本页 <a href="#2-3-prior-stage-config">§2.3</a> |33| `prior` | `list[object]` | 可选 | `[]` | — | 前置阶段列表,每阶段含 process 与 dataset | 本页 <a href="#2-3-prior-stage-config">§2.3</a> |
34| `process` | `list[object]` | 可选 | `[]` | — | 量化处理器链,按顺序执行;每个元素是 `type` 分派的处理器配置。 | 本页 <a href="#2-4-autoprocessorconfig">§2.4</a> |34| `process` | `list[object]` | 可选 | `[]` | — | 量化处理器链,按顺序执行;每个元素是 `type` 分派的处理器配置。 | 本页 <a href="#2-4-autoprocessorconfig">§2.4</a> |
35-| `per_expert` | `object / null` | 可选 | `null` | — | 按专家覆盖 process;值为 Processor 列表。某专家在此出现则整链替换,否则回退 process | 本页 <a href="#2-4-autoprocessorconfig">§2.4</a> |35+| `per_expert` | `object / null` | 可选 | `null` | — | 按专家覆盖 process 的字典;值为该专家的 Processor 列表。某专家在此出现则整链替换,否则回退 process | 本页 <a href="#2-4-autoprocessorconfig">§2.4</a> |
36| `save` | `list[object]` | 可选 | `[]` | — | 保存格式列表,每个元素是 `type` 分派的保存格式配置。 | 本页 <a href="#2-5-quantformatconfig">§2.5</a> |36| `save` | `list[object]` | 可选 | `[]` | — | 保存格式列表,每个元素是 `type` 分派的保存格式配置。 | 本页 <a href="#2-5-quantformatconfig">§2.5</a> |
37| `dataset` | `string` | 可选 | `mix_calib.jsonl` | — | 校准数据集名称(`lab_calib` 下的文件名)或数据集路径。 | 无 |37| `dataset` | `string` | 可选 | `mix_calib.jsonl` | — | 校准数据集名称(`lab_calib` 下的文件名)或数据集路径。 | 无 |
38| `multimodal_sd_config` | `object` | 可选 | 由工厂函数生成 | — | 多模态生成模型的专用配置,可为字典或 `MultimodalSDConfig` 实例,含 `dump_config``inference_config`。 | 本页 <a href="#2-6-multimodal-sd-config">§2.6</a> |38| `multimodal_sd_config` | `object` | 可选 | 由工厂函数生成 | — | 多模态生成模型的专用配置,可为字典或 `MultimodalSDConfig` 实例,含 `dump_config``inference_config`。 | 本页 <a href="#2-6-multimodal-sd-config">§2.6</a> |
@@ -61,9 +61,9 @@
61- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》61- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》
62- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》62- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》
63- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》63- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》
64-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》64+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》
65- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》65- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》
66-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》66+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》
67- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》67- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》
68- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》68- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》
69- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》69- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》
@@ -82,7 +82,7 @@
82- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》82- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》
83- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》83- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》
84- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》84- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》
85-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》85+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》
86 86 
87<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>87<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>
88 88 
@@ -60,9 +60,9 @@
60- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》60- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》
61- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》61- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》
62- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》62- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》
63-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》63+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》
64- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》64- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》
65-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》65+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》
66- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》66- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》
67- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》67- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》
68- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》68- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》
@@ -81,7 +81,7 @@
81- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》81- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》
82- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》82- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》
83- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》83- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》
84-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》84+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》
85 85 
86<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>86<h3 id="2-5-quantformatconfig">2.5 QuantFormatConfig</h3>
87 87 
@@ -31,7 +31,7 @@
31 31 
32| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |32| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
33|----------|------|-----------|--------|----------------|------|----------|33|----------|------|-----------|--------|----------------|------|----------|
34-| `expectations` | `list[object]` | 必选 | 无 | — | 精度期望列表,至少 1 个;每项声明数据集与目标精度(含容差) | 本页 <a href="#2-3-accuracy-expectation">§2.3</a> |34+| `expectations` | `list[object]` | 必选 | 无 | — | 精度期望列表,至少1个;每项声明数据集与目标精度(含容差) | 本页 <a href="#2-3-accuracy-expectation">§2.3</a> |
35 35 
36**配置约束**36**配置约束**
37 37 
@@ -227,8 +227,6 @@ evaluation:
227 top_p: 0.9227 top_p: 0.9
228 seed: null228 seed: null
229 repetition_penalty: 1.03229 repetition_penalty: 1.03
230- chat_template_kwargs:
231- thinking: true
232 model_meta:230 model_meta:
233 base_name: vllm_api_general_chat231 base_name: vllm_api_general_chat
234 subdir: vllm_api232 subdir: vllm_api
@@ -241,6 +239,8 @@ evaluation:
241 aime25:239 aime25:
242 config_name: aime2025_gen_0_shot_chat_prompt240 config_name: aime2025_gen_0_shot_chat_prompt
243 mode: all241 mode: all
242+ chat_template_kwargs:
243+ thinking: true
244 bfcl-simple:244 bfcl-simple:
245 config_name: BFCL_gen_simple245 config_name: BFCL_gen_simple
246 mode: all246 mode: all
@@ -91,8 +91,6 @@ evaluation:
91 top_p: 0.991 top_p: 0.9
92 seed: null92 seed: null
93 repetition_penalty: 1.0393 repetition_penalty: 1.03
94- chat_template_kwargs:
95- thinking: true
96 model_meta:94 model_meta:
97 base_name: vllm_api_general_chat95 base_name: vllm_api_general_chat
98 subdir: vllm_api96 subdir: vllm_api
@@ -105,6 +103,8 @@ evaluation:
105 aime25:103 aime25:
106 config_name: aime2025_gen_0_shot_chat_prompt104 config_name: aime2025_gen_0_shot_chat_prompt
107 mode: all105 mode: all
106+ chat_template_kwargs:
107+ thinking: true
108 bfcl-simple:108 bfcl-simple:
109 config_name: BFCL_gen_simple109 config_name: BFCL_gen_simple
110 mode: all110 mode: all
@@ -17,7 +17,7 @@
17| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |17| 字段路径 | 类型 | 必选/可选 | 默认值 | 取值范围或格式 | 含义 | 引用配置 |
18|----------|------|-----------|--------|----------------|------|----------|18|----------|------|-----------|--------|----------------|------|----------|
19| `type` | `string` | 可选 | `standing_high` | `standing_high` | 策略类型,固定为 `standing_high` | 无 |19| `type` | `string` | 可选 | `standing_high` | `standing_high` | 策略类型,固定为 `standing_high` | 无 |
20-| `anti_outlier_strategies` | `list[list[object]]` | 必选 | 无 | — | 离群值抑制处理器链列表,至少 1 个;每个元素是一条处理器链,链内每个处理器是 `type` 分派的处理器配置(如 smooth_quant 等) | 本页 <a href="#2-2-autoprocessorconfig">§2.2</a> |20+| `anti_outlier_strategies` | `list[list[object]]` | 必选 | 无 | — | 离群值抑制处理器链列表,至少1个;每个元素是一条处理器链,链内每个处理器是 `type` 分派的处理器配置(如 smooth_quant 等) | 本页 <a href="#2-2-autoprocessorconfig">§2.2</a> |
21| `template` | `object` | 可选 | 由工厂函数生成 | — | 完整的PracticeConfig模板,用于提取所有配置(包括线性层量化)。如果未提供,将使用默认的V1模板 | 《[modelslim_v1_spec 配置说明](../task/modelslim_v1.md#2-2-modelslim-v1-spec)》 |21| `template` | `object` | 可选 | 由工厂函数生成 | — | 完整的PracticeConfig模板,用于提取所有配置(包括线性层量化)。如果未提供,将使用默认的V1模板 | 《[modelslim_v1_spec 配置说明](../task/modelslim_v1.md#2-2-modelslim-v1-spec)》 |
22| `metadata` | `object` | 可选 | 见嵌套配置默认值 | — | 量化配置元数据(config_id / label 等) | 本页 <a href="#2-3-metadata">§2.3</a> |22| `metadata` | `object` | 可选 | 见嵌套配置默认值 | — | 量化配置元数据(config_id / label 等) | 本页 <a href="#2-3-metadata">§2.3</a> |
23 23 
@@ -32,9 +32,9 @@
32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》32- `AdaptRotationProcessorConfig``type: adapt_rotation`) — 自适应旋转(adapt_rotation)处理器配置。 《[adapt_rotation 配置说明](../processor/adapt_rotation.md)》
33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》33- `AutoroundProcessorConfig``type: autoround_quant`) — autoround 量化处理器配置。 《[autoround_quant 配置说明](../processor/autoround_quant.md)》
34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》34- `AWQProcessorConfig``type: awq`) — AWQ(Activation-aware Weight Quantization)处理器配置。 《[awq 配置说明](../processor/awq.md)》
35-- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》35+- `BinaryAnalysisProcessorConfig`(`type: binary_analysis`) — 二值(有/无量化)敏感分析处理器配置。 《[binary_analysis 配置说明](../processor/binary_analysis.md)》
36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》36- `BinaryOperatorLayerWiseProcessorConfig``type: binary_operator_layer_wise`) — 逐层敏感度分析处理器配置(对比逐块浮点与量化输出)。 《[binary_operator_layer_wise 配置说明](../processor/binary_operator_layer_wise.md)》
37-- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》37+- `BinaryOperatorModelWiseProcessorConfig`(`type: binary_operator_model_wise`) — 模型级敏感分析配置(对比模型最终输出,使用 MSE 指标) 《[binary_operator_model_wise 配置说明](../processor/binary_operator_model_wise.md)》
38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》38- `DynamicCacheProcessorConfig``type: dynamic_cache`) — KV cache 量化处理器配置。 《[dynamic_cache 配置说明](../processor/dynamic_cache.md)》
39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》39- `FA3QuantProcessorConfig``type: fa3_quant`) — FA3(FlashAttention-3)量化处理器配置。 《[fa3_quant 配置说明](../processor/fa3_quant.md)》
40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》40- `FlatQuantProcessorConfig``type: flatquant`) — FlatQuant处理器配置:定义量化训练参数、策略、混合精度等 《[flatquant 配置说明](../processor/flatquant.md)》
@@ -53,7 +53,7 @@
53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》53- `SmoothQuantProcessorConfig``type: smooth_quant`) — SmoothQuant 平滑量化处理器配置。 《[smooth_quant 配置说明](../processor/smooth_quant.md)》
54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》54- `SVDResidualProcessorConfig``type: svd_res`) — SVD 残差(低秩补偿)处理器配置。 《[svd_res 配置说明](../processor/svd_res.md)》
55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》55- `TrainableLinearQuantProcessorConfig``type: trainable_linear_quant`) — 可训练线性量化(TLQ)处理器配置。 《[trainable_linear_quant 配置说明](../processor/trainable_linear_quant.md)》
56-- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》56+- `UnaryAnalysisProcessorConfig`(`type: unary_analysis`) — 一元(无量化)敏感分析处理器配置。 《[unary_analysis 配置说明](../processor/unary_analysis.md)》
57 57 
58<h3 id="2-3-metadata">2.3 Metadata</h3>58<h3 id="2-3-metadata">2.3 Metadata</h3>
59 59 
@@ -134,8 +134,6 @@ evaluation:
134 top_p: 0.9134 top_p: 0.9
135 seed: null135 seed: null
136 repetition_penalty: 1.03136 repetition_penalty: 1.03
137- chat_template_kwargs:
138- thinking: true
139 model_meta:137 model_meta:
140 base_name: vllm_api_general_chat138 base_name: vllm_api_general_chat
141 subdir: vllm_api139 subdir: vllm_api
@@ -148,6 +146,8 @@ evaluation:
148 aime25:146 aime25:
149 config_name: aime2025_gen_0_shot_chat_prompt147 config_name: aime2025_gen_0_shot_chat_prompt
150 mode: all148 mode: all
149+ chat_template_kwargs:
150+ thinking: true
151 bfcl-simple:151 bfcl-simple:
152 config_name: BFCL_gen_simple152 config_name: BFCL_gen_simple
153 mode: all153 mode: all
@@ -76,8 +76,6 @@ evaluation:
76 top_p: 0.976 top_p: 0.9
77 seed: null77 seed: null
78 repetition_penalty: 1.0378 repetition_penalty: 1.03
79- chat_template_kwargs:
80- thinking: true
81 model_meta:79 model_meta:
82 base_name: vllm_api_general_chat80 base_name: vllm_api_general_chat
83 subdir: vllm_api81 subdir: vllm_api
@@ -90,6 +88,8 @@ evaluation:
90 aime25:88 aime25:
91 config_name: aime2025_gen_0_shot_chat_prompt89 config_name: aime2025_gen_0_shot_chat_prompt
92 mode: all90 mode: all
91+ chat_template_kwargs:
92+ thinking: true
93 bfcl-simple:93 bfcl-simple:
94 config_name: BFCL_gen_simple94 config_name: BFCL_gen_simple
95 mode: all95 mode: all
@@ -100,8 +100,6 @@ evaluation:
100 top_p: 0.9100 top_p: 0.9
101 seed: null101 seed: null
102 repetition_penalty: 1.03102 repetition_penalty: 1.03
103- chat_template_kwargs:
104- thinking: true
105 model_meta:103 model_meta:
106 base_name: vllm_api_general_chat104 base_name: vllm_api_general_chat
107 subdir: vllm_api105 subdir: vllm_api
@@ -114,6 +112,8 @@ evaluation:
114 aime25:112 aime25:
115 config_name: aime2025_gen_0_shot_chat_prompt113 config_name: aime2025_gen_0_shot_chat_prompt
116 mode: all114 mode: all
115+ chat_template_kwargs:
116+ thinking: true
117 bfcl-simple:117 bfcl-simple:
118 config_name: BFCL_gen_simple118 config_name: BFCL_gen_simple
119 mode: all119 mode: all
@@ -135,7 +135,7 @@ class MultimodalSDServiceConfig(BaseModel):
135 )135 )
136 per_expert: Optional[Dict[str, AutoProcessorConfigList]] = Field(136 per_expert: Optional[Dict[str, AutoProcessorConfigList]] = Field(
137 default=None,137 default=None,
138- description="按专家覆盖 process;值为 Processor 列表。某专家在此出现则整链替换,否则回退 process",138+ description="按专家覆盖 process 的字典;值为该专家的 Processor 列表。某专家在此出现则整链替换,否则回退 process",
139 )139 )
140 save: AutoSaverConfigList = Field(140 save: AutoSaverConfigList = Field(
141 default_factory=list,141 default_factory=list,
@@ -109,7 +109,7 @@ class StandingHighStrategyConfig(StrategyConfig):
109 type: Literal["standing_high"] = Field(default="standing_high", description="策略类型,固定为 `standing_high`")109 type: Literal["standing_high"] = Field(default="standing_high", description="策略类型,固定为 `standing_high`")
110 110 
111 anti_outlier_strategies: Annotated[List[AutoProcessorConfigList], AfterValidator(at_least_one_element)] = Field(111 anti_outlier_strategies: Annotated[List[AutoProcessorConfigList], AfterValidator(at_least_one_element)] = Field(
112- description="离群值抑制处理器链列表,至少 1 个;每个元素是一条处理器链,链内每个处理器是 `type` 分派的处理器配置(如 smooth_quant 等)"112+ description="离群值抑制处理器链列表,至少1个;每个元素是一条处理器链,链内每个处理器是 `type` 分派的处理器配置(如 smooth_quant 等)"
113 )113 )
114 114 
115 template: ModelslimV1ServiceConfig = Field(115 template: ModelslimV1ServiceConfig = Field(
@@ -39,7 +39,7 @@ class EvaluateDemand(BaseModel):
39 """评估需求:声明需要在哪些数据集上达到哪些精度期望。"""39 """评估需求:声明需要在哪些数据集上达到哪些精度期望。"""
40 40 
41 expectations: Annotated[List[AccuracyExpectation], AfterValidator(at_least_one_element)] = Field(41 expectations: Annotated[List[AccuracyExpectation], AfterValidator(at_least_one_element)] = Field(
42- description="精度期望列表,至少 1 个;每项声明数据集与目标精度(含容差)"42+ description="精度期望列表,至少1个;每项声明数据集与目标精度(含容差)"
43 )43 )
44 44 
45 45 
@@ -64,7 +64,6 @@ _FULL_EXAMPLE = {
64 'top_p': 0.9,64 'top_p': 0.9,
65 'seed': None,65 'seed': None,
66 'repetition_penalty': 1.03,66 'repetition_penalty': 1.03,
67- 'chat_template_kwargs': {'thinking': True},
68 },67 },
69 'model_meta': {68 'model_meta': {
70 'base_name': 'vllm_api_general_chat',69 'base_name': 'vllm_api_general_chat',
@@ -75,7 +74,11 @@ _FULL_EXAMPLE = {
75 },74 },
76 'datasets': {75 'datasets': {
77 'gsm8k': {'config_name': 'gsm8k_gen_0_shot_cot_str', 'mode': 'all'},76 'gsm8k': {'config_name': 'gsm8k_gen_0_shot_cot_str', 'mode': 'all'},
78- 'aime25': {'config_name': 'aime2025_gen_0_shot_chat_prompt', 'mode': 'all'},77+ 'aime25': {
78+ 'config_name': 'aime2025_gen_0_shot_chat_prompt',
79+ 'mode': 'all',
80+ 'chat_template_kwargs': {'thinking': True},
81+ },
79 'bfcl-simple': {82 'bfcl-simple': {
80 'config_name': 'BFCL_gen_simple',83 'config_name': 'BFCL_gen_simple',
81 'mode': 'all',84 'mode': 'all',
@@ -36,7 +36,7 @@ from msmodelslim.processor.analysis.binary_operator.metrics.factory import Binar
36 36 
37 37 
38class BinaryAnalysisProcessorConfig(AutoProcessorConfig):38class BinaryAnalysisProcessorConfig(AutoProcessorConfig):
39- """二值(有/无量化)敏感分析处理器配置。39+ """二值(有/无量化)敏感分析处理器配置。
40 40 
41 位于 `spec.process[]`,由 `type: binary_analysis` 分派;对比量化前后输出差异41 位于 `spec.process[]`,由 `type: binary_analysis` 分派;对比量化前后输出差异
42 (MSE),评估各层对量化的敏感度。42 (MSE),评估各层对量化的敏感度。
@@ -84,7 +84,7 @@ def _require_hidden_tensor(
84 84 
85 85 
86class BinaryOperatorModelWiseProcessorConfig(AutoProcessorConfig):86class BinaryOperatorModelWiseProcessorConfig(AutoProcessorConfig):
87- """模型级敏感分析配置(对比模型最终输出,使用 MSE 指标)"""87+ """模型级敏感分析配置(对比模型最终输出,使用 MSE 指标)"""
88 88 
89 type: Literal["binary_operator_model_wise"] = Field(89 type: Literal["binary_operator_model_wise"] = Field(
90 default="binary_operator_model_wise", description="处理器类型,固定为 `binary_operator_model_wise`。"90 default="binary_operator_model_wise", description="处理器类型,固定为 `binary_operator_model_wise`。"
@@ -96,8 +96,8 @@ class BinaryOperatorModelWiseProcessorConfig(AutoProcessorConfig):
96 quant_modules: List[Annotated[str, AfterValidator(validate_str_length())]] = Field(96 quant_modules: List[Annotated[str, AfterValidator(validate_str_length())]] = Field(
97 default_factory=lambda: ["*"],97 default_factory=lambda: ["*"],
98 description=(98 description=(
99- "与 linear_quant.include、CLI --quant_modules 一致(YAML 占位 ${quant_modules});"99+ "与 linear_quant.include、CLI --quant_modules 一致;"
100- "用于层敏感结果展示名后缀,如 model.layers.2 (*mlp*)。实际量化范围以 linear_quant 为准。"100+ "用于结果展示名后缀,如 model.layers.2 (*mlp*)。实际量化范围以 linear_quant 为准。"
101 ),101 ),
102 )102 )
103 configs: AutoProcessorConfigList = Field(103 configs: AutoProcessorConfigList = Field(
@@ -108,7 +108,7 @@ class BinaryOperatorModelWiseProcessorConfig(AutoProcessorConfig):
108 108 
109@QABCRegistry.register(dispatch_key=BinaryOperatorModelWiseProcessorConfig, abc_class=AutoSessionProcessor)109@QABCRegistry.register(dispatch_key=BinaryOperatorModelWiseProcessorConfig, abc_class=AutoSessionProcessor)
110class BinaryOperatorModelWiseProcessor(AutoSessionProcessor):110class BinaryOperatorModelWiseProcessor(AutoSessionProcessor):
111- """模型级敏感分析"""111+ """模型级敏感分析"""
112 112 
113 def __init__(113 def __init__(
114 self,114 self,
@@ -36,7 +36,7 @@ from msmodelslim.utils.exception import UnexpectedError
36 36 
37 37 
38class UnaryAnalysisProcessorConfig(AutoProcessorConfig):38class UnaryAnalysisProcessorConfig(AutoProcessorConfig):
39- """一元(无量化)敏感分析处理器配置。39+ """一元(无量化)敏感分析处理器配置。
40 40 
41 位于 `spec.process[]`,由 `type: unary_analysis` 分派;基于激活分布统计量41 位于 `spec.process[]`,由 `type: unary_analysis` 分派;基于激活分布统计量
42 (分位数/标准差/峰度)评估各层对量化的敏感度。42 (分位数/标准差/峰度)评估各层对量化的敏感度。
@@ -133,7 +133,7 @@ class TrainableLinearQuantProcessorConfig(AutoProcessorConfig):
133 strategies: List[QuantStrategyConfig] = Field(133 strategies: List[QuantStrategyConfig] = Field(
134 default_factory=list,134 default_factory=list,
135 min_length=1,135 min_length=1,
136- description="量化策略配置列表;未提供时为空列表,不应用量化策略;若显式提供则至少 1 项。",136+ description="量化策略配置列表;未提供时为空列表,不应用量化策略;若显式提供则至少1项。",
137 )137 )
138 train_with_act_quant: bool = Field(138 train_with_act_quant: bool = Field(
139 default=False,139 default=False,
@@ -99,7 +99,7 @@ class BlockTrainConfig(BaseModel):
99 default=0.01,99 default=0.01,
100 gt=0.0,100 gt=0.0,
101 validation_alias=AliasChoices("lr", "learning_rate"),101 validation_alias=AliasChoices("lr", "learning_rate"),
102- description="全局基础学习率",102+ description="全局基础学习率(别名 `learning_rate`)",
103 )103 )
104 select_best: SelectBestConfig = Field(104 select_best: SelectBestConfig = Field(
105 default_factory=EmaSelectBest,105 default_factory=EmaSelectBest,
@@ -841,6 +841,22 @@ def extract_fields(model_cls: type, name_of: Any = None) -> List[FieldRecord]:
841 record.nested_models = [name_of(nested) for nested in model_nested]841 record.nested_models = [name_of(nested) for nested in model_nested]
842 if record.default == "无" and not record.required:842 if record.default == "无" and not record.required:
843 record.default = _default_text(info)843 record.default = _default_text(info)
844+ # 取值范围列补足默认值语义:默认 null 的可空字段补充「或 null」;
845+ # 默认空列表且非必填的 list 字段把 minItems 表达为「0项或≥N项」。
846+ if record.constraint and record.constraint != "—":
847+ if record.default == "`null`" and "null" not in record.constraint:
848+ record.constraint = f"{record.constraint};或 null"
849+ if not record.required and "最少" in record.constraint:
850+ try:
851+ default_value = (
852+ info.default_factory()
853+ if info.default_factory is not None
854+ else (info.default if info.default is not PydanticUndefined else None)
855+ )
856+ except Exception:
857+ default_value = None
858+ if default_value in ([], {}, ""):
859+ record.constraint = re.sub(r"最少(\d+)项", r"0项或≥\1项", record.constraint)
844 if record.description == "—" and info.description:860 if record.description == "—" and info.description:
845 record.description = info.description.strip() or "—"861 record.description = info.description.strip() or "—"
846 kept.append(record)862 kept.append(record)