Skip to content

[docs]资料架构重构 - #1

Open
Keithwwa wants to merge 77 commits into
masterfrom
pr_docs_re_copy
Open

[docs]资料架构重构#1
Keithwwa wants to merge 77 commits into
masterfrom
pr_docs_re_copy

Conversation

@Keithwwa

@Keithwwa Keithwwa commented Feb 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

Keithwwa and others added 9 commits February 2, 2026 15:40
Co-authored-by: xyxin_006<xyxin_hit@163.com>



# message auto-generated for no-merge-commit merge:
!100 merge bugfix/auto-tune-doc into master

【bugfix】【doc】自动调优特性资料优化

Created-by: xyxin_006
Commit-by: xyxin_006
Merged-by: ascend-robot
Description: 自动调优资料优化:
1、在usage.md中补充输出件简要介绍,强调需要评估配置和量化配置同时匹配时才能复用历史精度数据
2、在configuration_protocols.md中,针对precheck字段,暂时不体现 ‘garbled_text’ 类型

See merge request: Ascend/msmodelslim!100
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Keithwwa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求对msModelSlim项目的文档进行了大规模的重构和优化。核心目标是提升文档的可读性、可维护性和用户体验,通过引入现代化的MkDocs系统,并对内容进行逻辑分组,使新用户能够快速上手,老用户也能更高效地查找所需信息。此次重构为未来的文档扩展和功能更新奠定了坚实基础。

Highlights

  • 文档架构重构: 对整个文档结构进行了全面重构,将现有文档重新组织到更清晰、更具逻辑性的分类中,包括“开始使用”、“模型支持列表”、“功能指南”、“调试案例集”和“开发者指南”等新模块。
  • 引入MkDocs文档系统: 新增了.readthedocs.yamlmkdocs.yml配置文件,表明项目已切换到MkDocs作为文档生成工具,并引入了自定义CSS以优化侧边栏显示效果。
  • 新增和更新文档内容: 新增了msModelSlim的欢迎页和未来功能展望,详细介绍了量化算法总览、一键量化(V1)的使用指南及线性层量化,并为旧版API(V0)创建了独立的文档区域,同时更新了现有文档中的内部链接和标点符号。
  • Python API文档迁移: 将原有的Python API文档统一迁移至python_api_v0目录,以明确区分新旧API版本,为未来的API迭代做好准备。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 对文档结构进行了大规模重构,整体结构更加清晰,值得肯定。但也发现了一些问题,主要集中在以下几个方面:

  1. 内容重复docs/index.md 文件中存在重复的更新日志。
  2. 编码问题:多个 Markdown 文件中出现了乱码字符 ``,影响阅读体验。
  3. 链接失效:由于文件路径变更,部分文档中的相对链接未能正确更新,导致链接失效。
  4. CSS 样式extra.css 中使用了 !important,这会增加后续样式维护的难度。

具体问题请参考我提交的审查评论。建议在合并前修复这些问题,以保证文档的质量和可用性。

## 概述

本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径
本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径�?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

该文件的大部分行尾都出现了乱码字符 ``。这可能是由于文件编码问题或在编辑过程中引入的无效字符导致的。这严重影响了文档的可读性。请全局检查并移除这些乱码字符。

| QuaRot | 通过对权重和激活进行旋转变换,将离群值"分散"到多个通道,平滑分布 | 可与其他算法叠加使用,作为进一步提升精度的备选方案。对于 W4A4 等极端场景效果显著 | [quarot.md](../algorithms_instruction/quarot.md) |
| KV Smooth | 专门针对 KVCache 中的 Key 离群值抑制,将其迁移至 Query | **KVCache 量化必备**。在不改变注意力打分前提下压缩 K 的动态范围,提升生成质量 | [kv_smooth.md](../algorithms_instruction/kv_smooth.md) |
| LAOS | 协同优化方案。通过 QuaRot Iterative Smooth 抑制离群值,配合 AutoRound 优化权重舍入 | **W4A4 极致精度方案**。当前主要适配 Qwen3 稠密系列模型 | [laos.md](../algorithms_instruction/laos.md) |
| Smooth Quant | 仅对norm-linear子图做平滑处理,支持对称/非对�?| 在Qwen、DeepSeek等热门系列模型上精度较差,不建议使用 | [smooth_quant.md](../03-feature_guide/01-quantization_algorithms/smooth_quant.md) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

此处的链接路径似乎不正确。根据新的目录结构,它应该指向 ../feature_guide/quantization_algorithms/smooth_quant.md。请检查并修正此表格中所有算法文档的链接路径。

Suggested change
| Smooth Quant | 仅对norm-linear子图做平滑处理,支持对称/非对?| 在Qwen、DeepSeek等热门系列模型上精度较差,不建议使用 | [smooth_quant.md](../03-feature_guide/01-quantization_algorithms/smooth_quant.md) |
| Smooth Quant | 仅对norm-linear子图做平滑处理,支持对称/非对?| 在Qwen、DeepSeek等热门系列模型上精度较差,不建议使用 | [smooth_quant.md](../feature_guide/quantization_algorithms/smooth_quant.md) |

在一键量化中,通过 `qconfig.act.scope` 字段来区分 **静态量化** 与 **动态量化**:
- **静态量化 (`per_tensor`)**:在量化校准阶段统计并固定量化参数(scale和offset),推理时直接使用。**特点**:推理性能最优,计算开销最小,但在分布变化剧烈时精度可能受损。
- **动态量化 (`per_token`)**:在推理过程中,针对每个 token 实时计算量化参数。**特点**:量化粒度更细,能够更好地捕捉激活值的动态分布,**精度通常优于静态量化**,但会引入一定的实时计算开销。
- **PDMIX 混合量化 (`pd_mix`)**:Prefilling 阶段使用 `per_token`,Decoding 阶段使用 `per_tensor`。**特点**:旨在平衡精度和性能,特别适用于生成式模型的推理加速,参考[PDMIX:激活值阶段间混合量化算法说明](../../algorithms_instruction/pdmix.md)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

此处的链接路径 ../../algorithms_instruction/pdmix.md 不正确。pdmix.md 文件与当前文件位于同一目录下,因此链接应为 pdmix.md。请修正此文件中所有类似的相对路径链接。

Suggested change
- **PDMIX 混合量化 (`pd_mix`)**:Prefilling 阶段使用 `per_token`,Decoding 阶段使用 `per_tensor`**特点**:旨在平衡精度和性能,特别适用于生成式模型的推理加速,参考[PDMIX:激活值阶段间混合量化算法说明](../../algorithms_instruction/pdmix.md)
- **PDMIX 混合量化 (`pd_mix`)**:Prefilling 阶段使用 `per_token`,Decoding 阶段使用 `per_tensor`**特点**:旨在平衡精度和性能,特别适用于生成式模型的推理加速,参考[PDMIX:激活值阶段间混合量化算法说明](pdmix.md)

@@ -1,56 +1,56 @@
# MinMax:最小最大值量化算法说明
# MinMax:最小最大值量化算法说�?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

该文件的大部分行尾都出现了乱码字符 ``。这可能是由于文件编码问题或在编辑过程中引入的无效字符导致的。这严重影响了文档的可读性。请全局检查并移除这些乱码字符。

@@ -1,127 +1,127 @@
# QuaRot:基于旋转的离群值抑制算法说明
# QuaRot:基于旋转的离群值抑制算法说�?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

该文件的大部分行尾都出现了乱码字符 ``。这可能是由于文件编码问题或在编辑过程中引入的无效字符导致的。这严重影响了文档的可读性。请全局检查并移除这些乱码字符。

## 使用前准备

安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../install_guide.md)。
安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../01-getting_started/install_guide.md)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

此处的链接路径 ../../01-getting_started/install_guide.md 不正确。根据新的目录结构,正确的相对路径应为 ../../getting_started/install_guide.md。请检查并修正此文件中所有类似的路径问题。

Suggested change
安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../01-getting_started/install_guide.md)
安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../getting_started/install_guide.md)

Comment thread docs/zh/getting_started/quick_start.md Outdated
可通过[大模型支持矩阵](foundation_model_support_matrix.md)查看不同模型的一键量化支持情况,其中标记了`一键量化`的模型则已支持一键量化。

### 相关资料
- 对于过大的模型,可以参考[一键量化使用指南](../03-feature_guide/02-one_click_quantization_v1/usage.md#逐层量化)使用逐层量化,能够明显降低显存使用。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

此处的链接路径 ../03-feature_guide/02-one_click_quantization_v1/usage.md 不正确。根据新的目录结构,正确的相对路径应为 ../feature_guide/quick_quantization_v1/usage.md。请检查并修正此文件中所有类似的路径问题。

Suggested change
- 对于过大的模型,可以参考[一键量化使用指南](../03-feature_guide/02-one_click_quantization_v1/usage.md#逐层量化)使用逐层量化,能够明显降低显存使用。
- 对于过大的模型,可以参考[一键量化使用指南](../feature_guide/quick_quantization_v1/usage.md#逐层量化)使用逐层量化,能够明显降低显存使用。

Comment thread docs/index.md
Comment on lines +26 to +29
- msModelSlim 支持 DeepSeek-V3.2-Exp W8A8 量化,单卡64G显存,100G内存即可执行
- msModelSlim 现已解决Qwen3-235B-A22B在W8A8量化下频繁出现"游戏副本"等异常token的问题 Qwen3-MoE 量化推荐实践
- msModelSlim 支持DeepSeek R1 W4A8 per-channel 量化【Prototype】
- msModelSlim 支持大模型量化敏感层分析

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这部分内容(从“msModelSlim 支持 DeepSeek-V3.2-Exp W8A8 量化”到“msModelSlim 支持大模型量化敏感层分析”)在“2025年10月”和“2025年9月”两个小节中完全重复了。请检查并移除其中一处的重复内容,保持更新日志的简洁和准确。

Comment thread docs/stylesheets/extra.css Outdated
Comment on lines +4 to +6
.md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.3rem !important;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在 CSS 中使用 !important 会破坏样式的层叠规则,使后续的样式覆盖和维护变得困难。建议移除 !important,并尝试通过提高选择器的特异性或利用 mkdocs-material 主题提供的自定义变量来实现相同的缩进效果。例如,可以查阅 mkdocs-material 的文档,看是否能通过覆盖 SASS/CSS 变量来调整导航栏的 padding

|--------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| apiversion | 必选 | 1. 当前支持列表:`"modelslim_v0"`、`"modelslim_v1"`、`"multimodal_vlm_modelslim_v1"`、`"multimodal_sd_modelslim_v1"`。<br> 2. 工具根据此字段选择对应的量化服务后端。<br> 3. 不同版本的量化服务可能有不同的配置字段和参数要求。 | 用于选择后端量化服务的版本,不同的量化服务有着不同的具体配置协议。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**:指定量化结果的保存方式和格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**:指定量化结果的保存方式 and 格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处存在拼写错误,格式 and 格式 应为 格式。请修正。

Suggested change
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**指定量化结果的保存方式 and 格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**指定量化结果的保存方式和格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |

@gemini-code-assist

Copy link
Copy Markdown

The previous comment is a summary of the pull request changes. It does not contain any questions or direct mentions that require a response from me at this time.

Keithwwa and others added 2 commits February 2, 2026 20:46
Co-authored-by: anreywmh<18845895998@163.com>



# message auto-generated for no-merge-commit merge:
!98 merge w_non_fusion_feature into master

【msmodelslim】【feature】离群值抑制支持非融合子图

Created-by: anreywmh
Commit-by: anreywmh
Merged-by: ascend-robot
Description: 1、IterSmoothInterface.get_adapter_config_for_subgraph mapping.source支持可配,不配置时默认为None,采用非融合子图结构
2、新增NonFusionSmoothQuantWrapper保存离群值抑制的scales以及确定前向
3、ascendV1 saver新增on_non_fusion_smooth_quant_wrapper,将原先的proj变为proj.div.mul_scales和proj.linear.weight两部分

See merge request: Ascend/msmodelslim!98
@Keithwwa

Keithwwa commented Feb 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次PR对文档结构进行了大规模的重构,引入了新的 mkdocs.yml 配置文件,并对大量文档文件进行了移动和重命名,使其结构更加清晰、合理。这是一个非常棒的改进,极大地提升了文档的可维护性和导航性。

我的审查主要集中在以下几个方面:

  • 内容准确性:发现了一些重复内容和描述不准确的地方,例如在首页的更新日志和目录结构说明文件中。
  • 可读性问题:多个Markdown文件中出现了乱码字符(``),这可能是文件编码或复制粘贴导致的问题,影响了文档的阅读体验。
  • 链接完整性:在文件移动后,部分文档内部的相对链接未能正确更新,导致链接失效。
  • CSS最佳实践:对CSS文件中 !important 的使用提出了一点小建议。

总的来说,这是一次非常有价值的重构。修复上述问题后,文档质量将得到进一步提升。

Comment thread docs/index.md
Comment on lines +26 to +29
- msModelSlim 支持 DeepSeek-V3.2-Exp W8A8 量化,单卡64G显存,100G内存即可执行
- msModelSlim 现已解决Qwen3-235B-A22B在W8A8量化下频繁出现"游戏副本"等异常token的问题 Qwen3-MoE 量化推荐实践
- msModelSlim 支持DeepSeek R1 W4A8 per-channel 量化【Prototype】
- msModelSlim 支持大模型量化敏感层分析

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

“最新消息”中,9月和10月的部分内容重复,看起来是复制粘贴错误。建议删除重复的条目以保持更新日志的清晰和准确。

Comment thread docs/stylesheets/extra.css Outdated

/* 二级目录缩进 */
.md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.3rem !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在CSS中使用 !important 可能会使未来的样式维护和主题升级变得困难。建议尝试使用更具体的选择器来覆盖主题的默认样式,以避免使用 !important。例如,可以尝试增加选择器的层级,如 body .md-nav__item .md-nav__item .md-nav__link

## 概述

本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径
本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径�?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

文件中多处出现了乱码字符“”,尤其是在句末。这可能是由于文件编码问题或复制粘贴时引入的。这严重影响了文档的可读性,建议全局检查并移除这些乱码字符。

Suggested change
本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径�?
本文档提供了一套系统化的量化精度调优方法论,遵循“确认精度问题可信→调整离群值抑制算法→调整量化策略→调整校准集→量化回退”的递进路径


- **背景**:一方面,在长序列下,Attention 的中间激活 Q、K、V 张量在显存中占比高,对其进行量化将有效降低显存占用并提升计算效率;另一方面,Q、K、V 的激活动态范围大且分布高度不均,直接进行全局量化可能会导致精度损失严重。
- **核心思想**:Flash Attention 3(FA3)是一种针对注意力机制激活的 per-head(逐注意力头)量化算法,对注意力机制中的 Q、K、V 激活进行 per-head 粒度的 INT8 量化,在保持模型精度的前提下提升推理性能和降低显存占用。FA3 量化通常与[线性量化](linear_quant.md)配合使用,以实现全量化方案。
- **核心思想**:Flash Attention 3(FA3)是一种针对注意力机制激活的 per-head(逐注意力头)量化算法,对注意力机制中的 Q、K、V 激活进行 per-head 粒度的 INT8 量化,在保持模型精度的前提下提升推理性能和降低显存占用。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处的描述移除了与linear_quant.md的配合说明,但FA3量化通常仍需与线性量化协同工作。建议在此处补充说明,并使用正确的相对路径链接到 linear_quant.md,例如 FA3 量化通常与[线性量化](linear_quant.md)配合使用,以实现全量化方案。,以帮助用户更好地理解其应用场景。

## 简介

- **简介**:KVCache量化机制。KV Cache 量化通常与[线性量化](linear_quant.md)配合使用,以实现全量化方案。
- **简介**:KVCache量化机制。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处的描述移除了与linear_quant.md的配合说明,但KVCache量化通常仍需与线性量化协同工作。建议在此处补充说明,并使用正确的相对路径链接到 linear_quant.md,例如 KV Cache 量化通常与[线性量化](linear_quant.md)配合使用,以实现全量化方案。,以帮助用户更好地理解其应用场景。

Comment on lines 1 to 56
# MinMax:最小最大值量化算法说�?

## 简介
## 简�?

- **概述**:MinMax 是一种最基础且最常用的量化算法。它通过统计张量(权重或激活值)中的最小值和最大值来确定量化范围,从而计算量化缩放因子(scale)和偏移量(offset)。
- **核心思想**:将原始浮点数范围线性映射到目标数值范围(如 INT8 的 [-128, 127] 或 FP8 的表示范围)。该算法简单高效,计算开销极低,是大多数常规量化场景的首选。

## 使用前准备
## 使用前准�?

安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../install_guide.md)
安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../install_guide.md)�?

## 原理和实现
## 原理和实�?

### 原理

MinMax 算法基于以下公式计算量化参数
MinMax 算法基于以下公式计算量化参数�?

1. **确定范围**
1. **确定范围**�?
- $V_{min} = \min(X)$
- $V_{max} = \max(X)$

2. **计算缩放因子 (Scale)**
2. **计算缩放因子 (Scale)**�?
- 对于非对称量化:$S = \frac{V_{max} - V_{min}}{Q_{max} - Q_{min}}$
- 对于对称量化:$S = \frac{\max(|V_{min}|, |V_{max}|)}{Q_{max}}$
- 对于对称量化�?S = \frac{\max(|V_{min}|, |V_{max}|)}{Q_{max}}$

3. **计算偏移量 (Offset)**
3. **计算偏移�?(Offset)**�?
- 对于非对称量化:$Z = Q_{min} - \text{round}(\frac{V_{min}}{S})$
- 对于对称量化:$Z = 0$
- 对于对称量化�?Z = 0$

其中 $Q_{max}$ 和 $Q_{min}$ 是目标数据类型的数值范围最大值和最小值。例如对于 INT8 对称量化,$Q_{max}=127$;对于 FP8 等浮点量化场景,则对应其格式所能表示的范围。

### 实现

算法在 `msmodelslim/core/quantizer/impl/minmax.py` 中实现
算法�?`msmodelslim/core/quantizer/impl/minmax.py` 中实现�?

## 功能介绍

`linear_quant` 处理器中使用 MinMax 算法
�?`linear_quant` 处理器中使用 MinMax 算法�?

```yaml
spec:
process:
- type: "linear_quant"
qconfig:
act:
method: "minmax" # 激活值使用 minmax
method: "minmax" # 激活值使�?minmax
weight:
method: "minmax" # 权重使用 minmax
```

### 参数说明

| 参数名 | 作用 | 可选值 | 说明 |
| 参数�?| 作用 | 可选�?| 说明 |
|--------|------|--------|------|
| method | 量化方法 | `"minmax"` | 指定使用 MinMax 算法 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

文件中多处出现了乱码字符“”,尤其是在句末。这可能是由于文件编码问题或复制粘贴时引入的。这严重影响了文档的可读性,建议全局检查并移除这些乱码字符。

Comment on lines +3 to +11
## 简�?

组合处理器(Group Processor)是 msModelSlim 中用于实现**精细化量化策略**的核心组件。它允许用户将多个处理器(如线性量化、平滑处理等)封装在一个逻辑组内,针对模型的不同层应用差异化的量化配置。

通过组合处理器,您可以轻松实现“混合量化”(Mixed Quantization),例如在同一个模型中对某些层使用静态量化以追求性能,而对另一些层使用动态量化以保证精度。

## 使用前准备
## 使用前准�?

安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../install_guide.md)
安装 msModelSlim 工具,详情请参见[《msModelSlim工具安装指南》](../../install_guide.md)�?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

文件中多处出现了乱码字符“”,尤其是在句末。这可能是由于文件编码问题或复制粘贴时引入的。这严重影响了文档的可读性,建议全局检查并移除这些乱码字符。

|--------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| apiversion | 必选 | 1. 当前支持列表:`"modelslim_v0"`、`"modelslim_v1"`、`"multimodal_vlm_modelslim_v1"`、`"multimodal_sd_modelslim_v1"`。<br> 2. 工具根据此字段选择对应的量化服务后端。<br> 3. 不同版本的量化服务可能有不同的配置字段和参数要求。 | 用于选择后端量化服务的版本,不同的量化服务有着不同的具体配置协议。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**:指定量化结果的保存方式和格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**:指定量化结果的保存方式 and 格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处的描述中混用了中英文("and")。为了保持文档语言的一致性,建议将 "and" 修改为中文的“和”。

Suggested change
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**指定量化结果的保存方式 and 格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |
| spec | 必选 | 1. **流水线定义**:指定量化处理的流水线类型。<br> 2. **处理器配置**:定义各种量化处理器的参数。<br>3. **保存策略**指定量化结果的保存方式和格式 <br>4. **数据集配置**:指定校准数据集 | 具体的量化服务配置字段,包含量化策略、处理流程和保存方式等所有具体参数。 |

Comment on lines +664 to +665
- [Calibrator.md](../../../python_api/foundation_model_compression_apis/foundation_model_quantization_apis/pytorch_Calibrator.md)
- [AntiOutlier.md](../../../python_api/foundation_model_compression_apis/foundation_model_quantization_apis/AntiOutlier.md)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

此处的链接已损坏。由于文档结构重构,python_api 目录已重命名为 python_api_v0,并且相对路径也需要调整。请更新链接以确保其指向正确的文件。

Suggested change
- [Calibrator.md](../../../python_api/foundation_model_compression_apis/foundation_model_quantization_apis/pytorch_Calibrator.md)
- [AntiOutlier.md](../../../python_api/foundation_model_compression_apis/foundation_model_quantization_apis/AntiOutlier.md)
- [Calibrator.md](../../python_api_v0/foundation_model_compression_apis/foundation_model_quantization_apis/pytorch_Calibrator.md)
- [AntiOutlier.md](../../python_api_v0/foundation_model_compression_apis/foundation_model_quantization_apis/AntiOutlier.md)

Comment thread msmodelslim/dir_structure.md Outdated
│ │ └── auto_precision_tuning/ # 自动精度调优
│ ├── case_studies/ # 调试案例集
│ ├── developer_guide/ # 开发者指南
│ ├── python_api/ # Python API 文档

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个目录结构描述似乎不准确。根据本次重构,docs/zh/python_api/ 目录已经被重命名为 docs/zh/python_api_v0/。为了避免混淆,建议从结构图中移除旧的 python_api/ 条目。

@Keithwwa

Keithwwa commented Feb 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 主要对文档架构进行了大规模重构,以适配 Read the Docs 托管,并引入了 mkdocs 作为文档生成工具。整体来看,这些改动极大地提升了文档的结构化和可维护性,值得肯定。

我发现了一些小问题,主要集中在 Markdown 格式、内容重复和 CSS 最佳实践方面:

  • README.md 中有一个损坏的链接。
  • docs/index.md 中存在重复的更新日志。
  • CSS 文件中使用了 !important,以及在 Markdown 文件中内联了 <style> 块,这些可以进一步优化以提高可维护性。
  • msmodelslim/dir_structure.md 文件的位置似乎不正确。

具体细节请参考我的行级评论。修复这些问题后,文档将更加完善。

Comment thread README.md Outdated
Comment on lines +95 to +96
具体安装步骤请查看[《msModelSlim工具安装指南》](https://modelslim.readthedocs.io/zh-cn/latest/zh/getting_started/install_guide/
)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

这个 Markdown 链接的格式不正确,因为右括号 ) 被换到了新的一行。这会导致链接无法正确渲染。
请将 ) 移到上一行的末尾来修复此问题。

Suggested change
具体安装步骤请查看[《msModelSlim工具安装指南》](https://modelslim.readthedocs.io/zh-cn/latest/zh/getting_started/install_guide/
)。
具体安装步骤请查看[《msModelSlim工具安装指南》](https://modelslim.readthedocs.io/zh-cn/latest/zh/getting_started/install_guide/)

Comment thread docs/index.md
Comment on lines +47 to +50
- msModelSlim 支持 DeepSeek-V3.2-Exp W8A8 量化,单卡64G显存,100G内存即可执行
- msModelSlim 现已解决Qwen3-235B-A22B在W8A8量化下频繁出现"游戏副本"等异常token的问题 Qwen3-MoE 量化推荐实践
- msModelSlim 支持DeepSeek R1 W4A8 per-channel 量化【Prototype】
- msModelSlim 支持大模型量化敏感层分析

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

“最新消息”部分中,2025年9月的内容与2025年10月的部分内容重复。这看起来像是一个复制粘贴错误。请移除重复的内容以保持文档的准确性。

Comment thread docs/stylesheets/extra.css Outdated
Comment on lines +4 to +11
.md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.3rem !important;
}

/* 三级目录缩进 */
.md-nav__item .md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.5rem !important;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在 CSS 中使用 !important 会破坏样式的自然级联,使代码更难维护和调试。建议尝试使用更具体的选择器来覆盖主题样式,以避免使用 !important

例如,您可以尝试一个更具体的选择器,如:

.md-sidebar--primary .md-nav__item .md-nav__item .md-nav__link {
    padding-left: 1.3rem;
}

这只是一个示例,具体需要根据 mkdocs-material 主题的 DOM 结构来确定。如果实在无法避免,可以保留 !important,但最好优先考虑其他方案。

Suggested change
.md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.3rem !important;
}
/* 三级目录缩进 */
.md-nav__item .md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.5rem !important;
}
.md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.3rem;
}
/* 三级目录缩进 */
.md-nav__item .md-nav__item .md-nav__item .md-nav__link {
padding-left: 1.5rem;
}

Comment on lines +835 to +848
<style>
.custom-table table {
border-collapse: collapse;
width: 100%;
border: 1px solid #dfe2e5;
}
.custom-table th, .custom-table td {
border: 1px solid #dfe2e5;
padding: 8px 12px;
}
.custom-table tr:nth-child(2n) {
background-color: #f6f8fa;
}
</style>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议将此处的 <style> 块内容移动到 docs/stylesheets/extra.css 文件中。将样式和内容分离是更好的做法,可以提高文档的可维护性,并保持 Markdown 文件的整洁。既然已经有了 extra.css 文件,将样式统一管理会更清晰。

Comment thread msmodelslim/dir_structure.md Outdated
Comment on lines +1 to +23
# 项目目录结构

```
msmodelslim/
├── docs/ # 项目文档目录
│ └── zh/ # 中文文档
│ ├── getting_started/ # 开始使用
│ ├── model_support/ # 模型支持列表
│ ├── feature_guide/ # 功能指南
│ │ ├── quantization_algorithms/ # 量化算法
│ │ ├── quick_quantization_v1/ # 一键量化 (V1)
│ │ ├── traditional_quantization_v0/ # 传统量化 (V0)
│ │ ├── sensitive_layer_analysis/ # 敏感层分析
│ │ └── auto_precision_tuning/ # 自动精度调优
│ ├── case_studies/ # 调试案例集
│ ├── developer_guide/ # 开发者指南
│ ├── python_api/ # Python API 文档
│ ├── python_api_v0/ # 传统 V0 API 文档
│ ├── dir_structure.md # 本文件
│ └── index.md # 文档主页
├── msmodelslim/ # 主代码包
└── ...
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这个文件 dir_structure.md 描述了文档的目录结构,但它被放在了 msmodelslim/ 包的根目录下,这似乎不太合适。
根据 README.md 中的链接 [目录文件](docs/zh/dir_structure.md),这个文件应该位于 docs/zh/dir_structure.md
请将此文件移动到正确的位置,并将其添加到 mkdocs.yml 的导航结构中,以便在文档网站上可以访问。

@Keithwwa

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 标题为“[docs]资料架构重构”,主要对项目的文档进行了大规模的重构,迁移到了基于 MkDocs 和 Read the Docs 的新架构。这包括添加 .readthedocs.yamlmkdocs.yml 配置文件,重组 docs/ 目录,并更新所有内部链接以适应新结构。除了文档之外,PR 还对内部的插件系统进行了重要的重构。新的插件加载机制通过 config.ini 进行声明式配置,并使用了更健壮的工厂模式,这提升了代码的模块化和可扩展性。此外,还包含了一些新功能和错误修复,例如增加了对“非融合”平滑量化的支持,改进了 bfloat16 数据类型在权重保存时的处理逻辑,并增强了配置模型的验证。总体而言,这是一次非常有价值的重构,显著改善了项目的用户文档和内部架构。我的审查意见主要集中在一个可能影响未来代码维护的代码清晰度问题上。

Comment on lines +79 to +82
"""
Forward pre-hook callable. No-op: this HookIR only carries state for save-time
conversion; scaling is done inside NonFusionSmoothQuantWrapper after replacement.
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

__call__ 方法的文档字符串指出这是一个“No-op”(无操作),并且缩放操作是在 NonFusionSmoothQuantWrapper 中完成的。然而,该方法在第 87-88 行的实现(inv_scale = (1.0 / self.scales).to(device=x.device, dtype=x.dtype); return x * inv_scale)实际上执行了缩放操作。这种矛盾可能会对未来的代码维护产生误导。请更新文档字符串,以准确描述此钩子(hook)在校准阶段会对输入应用反向缩放。

@Keithwwa

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次PR对文档架构进行了大规模重构,使其更加清晰和易于维护,同时将文档构建迁移到了Read the Docs。代码方面,对插件系统进行了出色的重构,使其更具扩展性和健壮性,并引入了非融合平滑量化等新功能。整体来看,这是一次高质量的重构,显著提升了项目的文档质量和代码架构。我发现了一个文档中的小问题,请查看具体评论。

Comment thread docs/index.md
Comment on lines +47 to +50
- msModelSlim 支持 DeepSeek-V3.2-Exp W8A8 量化,单卡64G显存,100G内存即可执行
- msModelSlim 现已解决Qwen3-235B-A22B在W8A8量化下频繁出现"游戏副本"等异常token的问题 Qwen3-MoE 量化推荐实践
- msModelSlim 支持DeepSeek R1 W4A8 per-channel 量化【Prototype】
- msModelSlim 支持大模型量化敏感层分析

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这部分“最新消息”的内容与“2025年10月”部分的内容完全重复,看起来是复制粘贴导致的错误。建议删除这部分重复的内容,以保持文档的整洁和准确性。

@Keithwwa

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次PR主要对文档架构进行了重构,迁移到MkDocs和Read the Docs,并对插件系统进行了重要的函数式重构,使其更具灵活性和可维护性。代码变更范围广泛,但与重构目标一致,结构清晰。我发现了一些关于文件末尾缺少换行符的小问题,并提出了修改建议。总体而言,这是一次出色的重构工作。

Comment thread config/config.ini

[Plugin:precheck_rule]
garbled_text = msmodelslim.infra.evaluation.precheck.garbled_text_rule:get_plugin
expected_answer = msmodelslim.infra.evaluation.precheck.expected_answer_rule:get_plugin No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议在文件末尾添加一个空行。这是一种普遍的编码约定,可以避免一些工具(如 cat)在处理文件时出现问题。

expected_answer = msmodelslim.infra.evaluation.precheck.expected_answer_rule:get_plugin

| Flex Smooth Quant| [Flex Smooth Quant:灵活平滑量化算法说明](../quantization_algorithms/outlier_suppression_algorithms/flex_smooth_quant.md)| [Flex Smooth Quant 适配](../quantization_algorithms/outlier_suppression_algorithms/flex_smooth_quant.md#模型适配)
| KV Smooth | [KVSmooth:KVCache量化离群值抑制算法说明](../quantization_algorithms/outlier_suppression_algorithms/kv_smooth.md) | [KV Smooth 适配](../quantization_algorithms/outlier_suppression_algorithms/kv_smooth.md#模型适配)
| QuaRot | [QuaRot:基于旋转的离群值抑制算法说明](../quantization_algorithms/outlier_suppression_algorithms/quarot.md) | [QuaRot 适配](../quantization_algorithms/outlier_suppression_algorithms/quarot.md#模型适配)
| FA3 | [FA3量化:Flash Attention 3激活量化算法说明](../quantization_algorithms/quantization_algorithms/fa3_quant.md) | [FA3 适配](../quantization_algorithms/quantization_algorithms/fa3_quant.md#模型适配) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议在文件末尾添加一个空行。这是一种普遍的编码约定,可以避免一些工具(如 cat)在处理文件时出现问题。

Suggested change
| FA3 | [FA3量化:Flash Attention 3激活量化算法说明](../quantization_algorithms/quantization_algorithms/fa3_quant.md) | [FA3 适配](../quantization_algorithms/quantization_algorithms/fa3_quant.md#模型适配)
| FA3 | [FA3量化:Flash Attention 3激活量化算法说明](../quantization_algorithms/quantization_algorithms/fa3_quant.md) | [FA3 适配](../quantization_algorithms/quantization_algorithms/fa3_quant.md#模型适配)

"""
if is_bf16:
return scale
return deqscale2int64(scale) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议在文件末尾添加一个空行。这是一种普遍的编码约定,可以避免一些工具(如 cat)在处理文件时出现问题。

Suggested change
return deqscale2int64(scale)
return deqscale2int64(scale)

return new_module
return None No newline at end of file
return prefix, new_module
return prefix, module No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议在文件末尾添加一个空行。这是一种普遍的编码约定,可以避免一些工具(如 cat)在处理文件时出现问题。

Suggested change
return prefix, module
return prefix, module

Keithwwa added a commit to Keithwwa/msmodelslim that referenced this pull request Feb 14, 2026
Co-authored-by: keith_wa<keith_wwa@163.com>



# message auto-generated for no-merge-commit merge:
!109 merge pr_docs_re_copy into master

【docs】资料架构重构,并将资料托管至readthedocs。

Created-by: keith_wa
Commit-by: keith_wa
Merged-by: ascend-robot
Description: 1. 动机 (Motivation)
内容上:
优化导航结构:原目录结构逻辑不清晰、目录层级深且链接复杂。
提升阅读体验:原 traditional_quantization_v0 目录下存在 20+ 个零散文档,内容分布碎片化,用户难以快速建立完整的技术全景认知。
消除内容冗余:多个文档之间存在重复的依赖说明、操作流程及参数介绍,增加了维护成本及版本不一致的风险。

呈现上:
提供专业资料托管:原docs/目录结构不清晰、目录名/文档名不直观(英文),跳转繁琐且无搜索功能。

2. 修改点 (Changes)

2.1 重新梳理目录结构
![image.png](https://raw.gitcode.com/user-images/assets/8444818/8bba19f9-e84e-4f71-bd5e-ffd310dde142/image.png 'image.png')

2.2. 文档整合与重构
V0及传统量化核心文档合并:将 20 多个零散文档按功能维度深度整合为 10篇核心指南:
# V0框架文档导航(已停止演进)

本目录文档按模型类型与任务场景重排,便于按需求快速定位。

## 一、传统模型量化与校准

- [传统模型量化与校准](traditional_model_quantization_and_calibration.md)
  - 包含 PyTorch/ONNX/MindSpore 训练后量化与 QAT。

## 二、大模型量化与压缩

- [大模型量化与校准](foundation_model_quantization_and_calibration.md)
  - 包含低显存量化、混合校准数据集、FA3 量化。
- [压缩与结构优化(大模型为主)](foundation_model_compression.md)
  - 包含稀疏量化与权重压缩、长序列压缩、权重压缩流程、低秩分解。

## 三、训练加速与模型改造

- [训练加速与模型改造](pruning_and_distillation.md)
  - 包含重要性剪枝、Transformer 剪枝、Sparse tool、模型蒸馏。
- [稀疏加速训练](sparse_acceleration_training.md)
  - 包含宽度扩增与深度扩增模型的稀疏训练加速流程。

## 四、工具与生态适配

- [辅助工具与专项指导](compression_utils.md)
  - 包含量化权重格式说明与 MindSpeed 适配器。
- [伪量化精度测试工具](fake_quantization_accuracy_testing_tool.md)
  - 包含 Precision Tool 使用方式与测试流程。
- [多模态生成模型推理优化](inference_optimization_for_multimodal_generative_model.md)
  - 包含 DiT 缓存优化与自适应采样优化流程。
- [常见代码示例](quantization_and_sparse_quantization_scenario_import_code_examples.md)
  - 包含常见量化/稀疏量化场景导入代码样例。

2.3 配置readthedocs文档托管:
https://modelslim.readthedocs.io/zh-cn/latest/

2.4 配置deepwiki:
https://deepwiki.com/Keithwwa/ModelSlim

3. 验证:

3.1. gimini代码检视:
Keithwwa/ModelSlim#1

See merge request: Ascend/msmodelslim!109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants