已合并
【poc】【feature】Support practice entry point for model adapter plugin #158
rookie_hongchuan创建于 2月27日
【poc】【feature】Support practice entry point for model adapter plugin #158
已合并
rookie_hongchuan创建于 2月27日
从已删除 :2026_Q1/support_practice_entry_point合入到Ascend/msmodelslimmaster
rookie_hongchuan成员
2月27日

改动概述

本 PR 支持通过 entry point 引入自定义 practice 目录,作为 model adapter 插件化能力的基础。

主要改动

1. 新增插件 practice 目录发现

  • 新增 \msmodelslim/infra/plugin_practice_dirs.py\:通过 entry point \msmodelslim.naive_quantization.practice_dirs\ 发现插件提供的 practice 根目录
  • 每个 entry point 为可调用对象(如 \module:function\),返回 \Path\ 或 \Path\ 列表,指向与 \lab_practice\ 同布局的 practice 目录

2. 应用与基础设施集成

  • **\practice_manager_infra.py**:集成插件发现的 practice 目录
  • **\application.py**:支持从插件 practice 目录加载配置
  • **\yaml_practice_manager.py**:扩展以支持多 practice 根目录

3. CLI 与配置

  • **_main_.py**:CLI 支持基于 entry point 的 practice 发现
  • **\config.ini**:配置调整

4. 文档与示例

  • 文档与 FAQ 更新(\docs/zh\)
  • 示例与 \lab_practice\ 精简(移除部分冗余配置/文档)

5. 模型适配

  • **\model_adapter.py**(qwen3_5_moe):适配与精简

提交记录

  • 【feature】 support introduce custom practice dirs via entry points

影响范围

  • 14 个文件变更,+147 / -164 行
  • 不影响现有 lab_practice 使用方式,仅增加通过 entry point 扩展 practice 的能力
likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 rookie_hongchuan 的贡献)
ascend-robotascend-robot成员
2月27日 添加了label:stat/needs-squash
ascend-robot
ascend-robot成员
2月27日 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-Ascend/msmodelslim ✅ joejoezhou, libarry (2/2) ✅ joejoezhou (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
ascend-robotascend-robot成员
2月27日 添加了label:ascend-cla/yes
rookie_hongchuan成员
2月27日 评论:

compile

likedislike
ascend-robotascend-robot成员
2月27日 添加了label:ci-pipeline-running
Rrookie_hongchuan成员
2月27日 强制推送  1 个提交:a007c68a-【feature】 support introduce custom practice dirs via entry points
ascend-robotascend-robot成员
2月27日 删除了label:stat/needs-squash
ascend-robot
ascend-robot成员
2月27日 评论:

问题/功能描述

本次PR旨在提升模型量化应用在配置管理方面的可追溯性与可扩展性。核心解决了两个问题:一是量化过程中配置文件的来源不透明,导致调试和问题排查困难;二是原有的最佳实践管理器无法灵活集成第三方或插件提供的配置,限制了系统的模块化扩展能力。

修改方案描述

本次修改主要包含两方面:一是增强日志可追溯性,在NaiveQuantizationApplication._quant方法中新增逻辑,记录所用最佳实践配置文件的完整路径,路径信息通过新增的PracticeManagerInfra.get_config_path方法查询获得。二是扩展配置管理功能,新增discover_plugin_practice_dirs函数以支持通过entry point机制动态发现插件配置目录,并在YamlPracticeManager中集成对这些目录的加载与查询,遵循“自定义 > 插件 > 官方”的优先级顺序,从而实现了配置来源的灵活扩展。

likedislike
Rrookie_hongchuan成员
2月27日 修改了pull request 的描述
Rrookie_hongchuan成员
2月27日 修改标题为 “【poc】【feature】Support practice entry point for model adapter plugin”,原标题为“【feature】Support practice entry point for model adapter plugin”
ascend-robotascend-robot成员
2月27日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
2月27日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
2月27日 评论:
流水线 PR-pipeline_msmodelslim#430 已完成
阶段 任务名 状态 详情
编译构建 Build_msmodelslim ✅ >>>
恶意代码检查 Antipoison_MindStudio-ModelSlim ✅ >>>
编码安全与规范检查 CodeCheck_MindStudio-ModelSlim ✅ >>>
开源片段检查 SCA_MindStudio-ModelSlim ✅ >>>
开发者测试 UT_msmodelslim ✅ >>>
PreSmoke_msmodelslim ✅ >>>
流水线 PR-pipeline_msmodelslim ✅ >>>
likedislike
Rrookie_hongchuan成员
2月28日 修改了pull request 的描述
joejoezhou成员2月28日进行代码检视2
msmodelslim/app/naive_quantization/practice_manager_infra.py
已过期
@@ -28,3 +32,4 @@
2832 @abstractmethod
2933 def __contains__(self, model_pedigree) -> bool:
3034 """Check if model pedigree is supported"""
joejoezhou2月28日评论:

【review】最佳实践不一定使用文件进行管理,可以改为get_url,在不同的场景下,url可以有不同的含义

likedislike
System
系统消息系统
2月28日 评论:

changed this line on 274e512a view diff detail

joejoezhou成员2月28日进行代码检视2
msmodelslim/infra/yaml_practice_manager.py
已过期
@@ -58,0 +66,4 @@
66+ continue
67+ try:
68+ get_valid_read_path(str(plugin_root), is_dir=True)
69+ db_map = {
joejoezhou2月28日评论:

【review】此处为第三方的最佳实践来源配置,建议改名为third_party_config_dirs

likedislike
System
系统消息系统
2月28日 评论:

changed this line on 274e512a view diff detail

Rrookie_hongchuan成员
2月28日 推送  1 个提交:274e512a-fix: address review - get_config_url and third_party_config_dirs
ascend-robotascend-robot成员
2月28日 添加了label:stat/needs-squash
Rrookie_hongchuan成员
2月28日 解决了最后一个问题
ascend-robotascend-robot成员
2月28日 删除了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
2月28日 评论:

Notification

This pull request source branch has changed, so removes the following label(s): ci-pipeline-passed.

likedislike
ascend-robot
ascend-robot成员
2月28日 评论:

CLA Signature Pass

rookie_hongchuan, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
rookie_hongchuan成员
2月28日 评论:

compile

likedislike
ascend-robotascend-robot成员
2月28日 添加了label:ci-pipeline-running
libowen
libowen成员
2月28日 评论:

/lgtm

likedislike
joejoezhou成员
2月28日 评论:

/lgtm
/approve

likedislike
ascend-robotascend-robot成员
2月28日 添加了label:approvedlgtm
ascend-robotascend-robot成员
2月28日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
2月28日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
2月28日 评论:
流水线 PR-pipeline_msmodelslim#435 已完成
阶段 任务名 状态 详情
编译构建 Build_msmodelslim ✅ >>>
恶意代码检查 Antipoison_MindStudio-ModelSlim ✅ >>>
编码安全与规范检查 CodeCheck_MindStudio-ModelSlim ✅ >>>
开源片段检查 SCA_MindStudio-ModelSlim ✅ >>>
开发者测试 UT_msmodelslim ✅ >>>
PreSmoke_msmodelslim ✅ >>>
流水线 PR-pipeline_msmodelslim ✅ >>>
likedislike
ascend-robot
ascend-robot成员
2月28日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: joejoezhou.
Reviewers who wrote a comment of /lgtm are: joejoezhou, libarry.

likedislike
ascend-robotascend-robot成员
2月28日 合入了pull request
ascend-robot
ascend-robot成员
2月28日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: joejoezhou.
Reviewers who wrote a comment of /lgtm are: libarry, joejoezhou.

likedislike
ascend-robot
ascend-robot成员
2月28日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
2月28日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: joejoezhou.
Reviewers who wrote a comment of /lgtm are: joejoezhou, libarry.

likedislike
ascend-robot
ascend-robot成员
2月28日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike