| 【重构】多模态生成模型量化服务重构wan2.2/hunyuanvideo【多模态生成量化兼容旧逻辑】
Co-authored-by: xiaoheng181<eudemoniaxh@163.com>
# message auto-generated for no-merge-commit merge:
!492 merge sd_refactor_legacy_model_adapters into master
【重构】多模态生成模型量化服务重构wan2.2/hunyuanvideo【多模态生成量化兼容旧逻辑】
Created-by: xiaoheng181
Commit-by: xiaoheng181
Merged-by: ascend-robot
Description: 感谢您贡献的Pull Request!
在提交之前,请务必阅读 [CONTRIBUTING.md](https://gitcode.com/Ascend/msmodelslim/blob/master/CONTRIBUTING.md)。
Thanks for sending a pull request!
BEFORE SUBMITTING, PLEASE READ [CONTRIBUTING.md](https://gitcode.com/Ascend/msmodelslim/blob/master/CONTRIBUTING.md).
## PR描述 (What this PR does / why we need it?)
- 请明确说明您提交PR的变更内容。本部分旨在概述所做的变更,以及此PR是如何解决该问题的。请尽可能地提供有助于评审人员更高效、更快速完成检视审查的实用说明。
本 PR 是多模态生成(multimodal_sd_modelslim_v1)重构的第二笔,依赖已合入(或同栈基于)sd_refactor_multimodal_sd_core 的双路径量化框架。在 Legacy 路径上,将主仓已接入的多模态生成模型适配器对齐 LegacyMultimodalPipelineInterface,使 multimodal_sd_modelslim_v1 可继续走 model_config + load_pipeline / run_calib_inference / apply_quantization 流程。
flux1/model_adapter.py
实现 LegacyMultimodalPipelineInterface;init_model 仅返回权重字典,pipeline 加载迁至 load_pipeline;校准与量化上下文与框架一致。
wan2_1/model_adapter.py
同上,保留 Wan2.1 校准推理与 load_pipeline / _setup_cache 行为。
qwen_image_edit/model_adapter.py
声明实现 LegacyMultimodalPipelineInterface(接口对齐,改动极小)。
对应 UT
更新 test_model_adapter_flux1.py、test_model_adapter_wan2_1.py(如 apply_quantization、load_pipeline 等用例)。
- 请说明为何需要这些更改,例如具体的使用场景或bug描述。
核心 PR 仅提供 Legacy / 新 pipeline 分发能力,未改具体模型适配器。本 PR 让 Flux1、Wan2.1、Qwen-Image-Edit 在重构后仍可通过 Legacy 分支完成量化,避免主仓已支持模型回归;Wan2.2 / Hunyuan 等重构适配器在后续 PR 合入。
依赖:请先合入 sd_refactor_multimodal_sd_core(或本 PR 的 base 已包含该提交)。
- 关联issue号(如果有)。
- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. If possible, please consider writing useful notes for better and faster reviews in your PR.
- Please clarify why the changes are needed. For instance, the use case and bug description.
- Related issue number (if any)
## 面向用户的变更 (Does this PR introduce _any_ user-facing change)?
- 请注意,这里指的是**任何**面向用户的变更,包括但不限于API、用户界面或其他使用方式上的变更。
无。 不改变一键量化 CLI 与对外 YAML 字段;在核心 PR 已合入前提下,上述模型仍使用既有 model_config + Legacy 流程,行为与重构前主仓路径对齐(由 UT 看护)。
- Note that it means *any* user-facing change including all aspects such as API, interface or other behavior changes.
## 功能验证 (How was this patch tested?)
请确认CI已通过增量及存量的单元测试用例。
如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤(最好提供完整的可复现的操作路径及关键截图),以便Committer能够快速复现验证,也便于后续的维护。
如果未添加测试,请说明未添加的原因,以及为何难添加测试。
- [_] 功能自验
- [_] 本地自验截图(涉及个人标识符等敏感信息请注意脱敏)
- [_] 新增/变更内容是否已新增/适配UT测试用例看护
CI passed with new added/existing test.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
- [_] Self-verification of the feature.
- [_] Screenshot of local self-verification (please anonymize any sensitive information such as personal identifiers)
- [_] Have new or modified unit test (UT) cases been added or adapted to cover the newly added or changed content?
See merge request: Ascend/msmodelslim!492 | 1 天前 |