| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Feature][SLA] Add AscendC backend Co-authored-by: yujunyu2<yujunyu3@huawei.com> Co-authored-by: openLiBingCI<openlibing-robot@openlibing.com> # message auto-generated for no-merge-commit merge: !332 merge dev into dev [Feature][SLA] Add AscendC backend Created-by: yjy_ac Commit-by: yujunyu2;openLiBingCI Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20251224 --> # Which issue(s) this PR fixes or accomplishes > Fixes #171 # Purpose 为了得到更高推理性能,补充SLA可选AscendC上Block Sparse Attention算子后端。 # Test Plan ## 运行方式 bash # CPU:参数校验(无需 NPU) export MINDIE_TEST_MODE=CPU python -m unittest tests.layers.flash_attn.test_sparse_linear_attn -v # 全量:含 NPU 实机(需 Ascend + build/build_plugin.sh + pip install -e .) export MINDIE_TEST_MODE=ALL python -m unittest tests.layers.flash_attn.test_sparse_linear_attn -v ## 测试用例 ### 初始化(CPU) - 默认 backend 为 triton - 支持 backend:triton、ascendc - ascendc head_dim 仅 64/128;triton head_dim 仅 16/32/64/128/256 - triton 默认 BLKQ=BLKK=64;triton 块大小仅 64/128;ascendc BLKK 须为 128 倍数 - 非法 backend / head_dim / block size 初始化时抛 ParametersInvalid ### get_block_map(NPU) - head_dim=64、BLK=128:sparse_map 为 int8,shape 正确,real_topk > 0 - head_dim=128、fp16、BLK=128:同上 - BLKQ=BLKK=64:按块 64 划分,shape 正确 ### forward 校验(CPU,mock get_block_map) - ascendc / triton:非 NPU 设备抛错,且不调用 get_block_map - ascendc:forward 输入 head_dim 非 64/128 抛错 - triton:forward 输入 head_dim 非 16/32/64/128/256 抛错 ### 端到端 smoke(NPU,无 mock) - triton:head_dim=64,BLK=128 → 输出 shape (1,2,1024,64),fp16 - triton:BLKQ=BLKK=64 → 输出 shape 正确,fp16 - triton:head_dim=128 → 输出 shape (1,2,1024,128),fp16 - ascendc:head_dim=64/128 → 输出 shape/dtype 正确(950 系 inner_precise=4,其余为 1) # Test Report 测试用例验证,其中包括同输入条件下AscendC和Triton后端精度对比测试一致  相较triton后端,ascendC后端性能提升接近15倍   See merge request: Ascend/MindIE-SD!332 | 1 个月前 | |
[Bugfix][moe]Fix MoE dispatcher routing and W8A8 precision alignment Co-authored-by: betta18<jiangmengyu1@huawei.com> # message auto-generated for no-merge-commit merge: !382 merge fix_dispatcher_default_routing into dev [Bugfix][moe]Fix MoE dispatcher routing and W8A8 precision alignment Created-by: betta18 Commit-by: betta18 Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes Fix part of #ISSUE ID # Purpose 本 PR 修复 MindIE-SD MoE 默认 dispatcher 选择和 W8A8 dynamic quant 路径中的精度问题。 主要修改包括: - 调整 MoE 默认 dispatcher 选择逻辑: - 原默认路由参考 vllm-ascend 的机型选择策略:A2 默认 static dispatcher,A3/A5 默认 dynamic dispatcher。 - 该策略主要适配大 EP 场景,通常满足 top_k < ep_size,dynamic dispatcher 更容易发挥通信优势。 - 同时,由于 A2 跨机 all-to-all 通信劣化较明显,因此 vllm-ascend 中 A2 默认使用 static dispatcher。 - MindIE-SD 作为通用 MoE 接口,不再直接按机型选择 dispatcher,而是根据 top_k 与 ep_size 的关系选择默认路径。 - 在 tokens_full=False 场景下,static dispatcher 需要先通过 all-gather 将各 rank 的 local tokens 拼成 full tokens,再在 finalize 阶段通过 reduce-scatter 返回 rank-local 结果。设全局 token 数为 T,hidden size 为 H,EP size 为 P,每个 token 选择 K 个 experts,则 static dispatcher 单 rank 通信量近似为 2 * T * H。 - dynamic dispatcher 不需要提前聚合 full tokens,而是在 dispatch/combine 两个阶段按 expert 所属 rank 交换被路由命中的 token。平均分布下,单 rank 通信量近似为 2 * T * K / P * H,约为 static dispatcher 的 K / P。 - 因此,当 top_k < ep_size 时,dynamic dispatcher 通常具有更低通信量;当 top_k >= ep_size 时,dynamic dispatcher 的通信优势下降,默认选择 static dispatcher 更稳妥。 - 非 EP 场景默认走 static dispatcher。 - 修复专家路由权重 dtype 导致的精度问题: - select_experts 输出的 topk_weights 转为 hidden_states.dtype。 - 避免 routing weight dtype 与后续 dispatch/combine 计算 dtype 不一致导致的 MoE 输出精度偏差。 - 对齐 W8A8 dynamic quant 行为: - W8A8 dynamic quant 显式指定 dst_type=torch.int8。 - 覆盖 prepare、dynamic dispatch 和 MLP 内部量化兜底路径,避免默认量化 dtype 带来的精度差异。 - 同步更新 MoE 相关测试: - 更新默认 dispatcher 选择测试,覆盖 top_k < ep_size 走 dynamic、top_k >= ep_size 走 static。 - 增加 W8A8 dynamic quant 显式 dst_type=torch.int8 的测试断言。 - 更新 W8A8 dynamic MLP 预量化路径精度对齐测试。 # Test Plan 测试重点包括: - MoE dispatcher 默认选择逻辑: - 非 EP 场景默认 static。 - EP 场景下 top_k < ep_size 默认 dynamic。 - EP 场景下 top_k >= ep_size 默认 static。 - 显式 dispatcher_type 可覆盖默认选择。 - MoE routing: - topk_weights dtype 与输入激活 dtype 对齐。 - 验证 routing weight dtype 对 MoE 输出精度的影响已修复。 - W8A8 dynamic quant: - dynamic dispatcher 在 all-to-all 前显式执行 INT8 dynamic quant。 - static prepare 在 all-gather 前显式执行 INT8 dynamic quant。 - MLP 内部量化路径与外部预量化路径保持一致。 # Test Report 在 MindIE-SD 中更新 MoE 相关单元测试,覆盖 dispatcher 路由选择、W8A8 dynamic quant 参数传递和 MLP 预量化精度对齐等场景。 涉及测试文件: - tests/layers/moe/test_moe.py - tests/layers/moe/test_moe_mlp.py - tests/layers/moe/test_token_dispatcher.py See merge request: Ascend/MindIE-SD!382 | 1 个月前 | |
[bugfix]解决测试用例导包失败的问题 Co-authored-by: mazhixin00_00<mazhixin7@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge init into dev [bugfix]解决测试用例导包失败的问题 Created-by: mazhixin00_00 Commit-by: mazhixin00_00 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20251224 --> # Which issue(s) this PR fixes or accomplishes 有些环境,跑测试用例导包失败的问题  # Test Plan 全量测试 # Test Report  See merge request: Ascend/MindIE-SD!199 | 4 个月前 | |
【docs】文档修改-增加API参考&加速API Co-authored-by: xiao-qing123<xiaoqing14@h-partners.com> # message auto-generated for no-merge-commit merge: !263 merge dev into dev 【docs】文档修改-增加API参考&加速API Created-by: xiao-qing123 Commit-by: xiao-qing123 Merged-by: ascend-robot Description: fixes [#86](https://gitcode.com/Ascend/MindIE-SD/issues/86) 1、新增API参考(社区API接口) 2、新增加速API(原社区layer层) 3、删除readme中的快速入门和单多卡并行示例内容(有单独的quick_start承载) 4、算子融合单独拆分出来,在特性章节独立存在 5、删除特性章节目录名称中的“加速特性” 6、黄区大模型检测问题修改 See merge request: Ascend/MindIE-SD!263 | 3 个月前 | |
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.path 和 ASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insert和 ASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.py 和 tests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试:  See merge request: Ascend/MindIE-SD!340 | 1 个月前 | |
[Feature][ops]Add frequency regulator operator Co-authored-by: w00955629<wangruonan14@huawei.com> # message auto-generated for no-merge-commit merge: !395 merge feature/frequency-optimization-op into dev [Feature][ops]Add frequency regulator operator Created-by: w00955629 Commit-by: w00955629 Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes # Purpose Add MindIE-SD plugin support for the CANN frequency optimization operator. This change adds: - C++ wrapper and registration for the two-stage aclnn operator flow. - BackendSelect registration for scalar-only dispatch. - Python API export from mindiesd. - Lightweight wrapper tests for parameter validation and torch op forwarding. - Incremental test mapping for the new plugin files. # Test Plan - Build MindIE-SD from source with the CANN package that contains the operator. - Install with editable mode. - Verify Python import and torch op registration. - Run a smoke test on supported hardware and confirm the operator returns success status. - Run wrapper unit tests for Python-side parameter validation. # Test Report - git diff --check: passed. - Python py_compile for modified Python files: passed. - GitCode remote hook: passed. - Source build and runtime smoke test on target environment: passed by local validation. See merge request: Ascend/MindIE-SD!395 | 24 天前 | |
[Chore][deps]Reorganize requirements into layers and loosen version constraints Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !398 merge requirment into dev [Chore][deps]Reorganize requirements into layers and loosen version constraints Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes Fix part of #92 # Purpose 按 #92「外部依赖治理」的阶段一(依赖声明收敛)重构依赖分层并放宽版本约束,让安装边界更清晰、降低版本漂移: - 核心运行依赖收敛到 requirements.txt:仅 torch/torch_npu 钉 2.9.0,其余用 >=/不锁;新增此前 import mindiesd 缺失的 safetensors。 - 服务化依赖就近放到 examples/service/requirements.txt(唯一真相源);模型生态间接依赖交由外部模型仓自管。 - examples/dummy_run/requirements.txt 补 torch_npu、tensorboard(示例实际需要)。 - 放宽测试/Lint 工具版本:coverage、pre-commit 改 >=;timm==0.9.12(1.x 会 ImportError)、mypy==1.13.0(保类型检查可复现)按需保留 pin。 - 文档(installation/quick_start/service.md,中英文同步)补充分层安装说明与 triton-ascend 3.2.1 的 GitCode 安装来源。 - THIRD_PARTY_LICENSES.txt 去版本号并对齐当前依赖集(补 torch_npu/triton/triton-ascend/safetensors,删过期条目)。 # Test Plan 1. 安装核心运行依赖:pip install -r requirements.txt(应非破坏性,不动 torch/torch_npu)。 2. 源码构建 wheel:python setup.py bdist_wheel。 3. 验证 import mindiesd 及调用接口(如构造 QuantConfig / OnlineQuantConfig)。 4. (SparseLinearAttention)从 GitCode 发布页装 triton-ascend 3.2.1,确认无禁用告警。 5. 核对 installation/quick_start 文档安装路径与 THIRD_PARTY_LICENSES 清单。 # Test Report - pip install -r requirements.txt:非破坏性(装入 triton 3.5.0 / triton-ascend 3.2.1 / strenum,torch 与 torch_npu 不变)。 - python setup.py bdist_wheel:成功,产出 dist/mindiesd-3.0.0-*.whl 与 mindiesd/plugin/libPTAExtensionOPS.so。 - import mindiesd:通过,16 个 __all__ 符号全部可达。 See merge request: Ascend/MindIE-SD!398 | 30 天前 | |
[Bugfix][ops]Add dimension validation to prevent size_t underflow in layernorm Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !305 merge layernorm into dev [Bugfix][ops]Add dimension validation to prevent size_t underflow in layernorm Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix #<141> # Purpose 修复 csrc/plugin/layernorm.cpp 中 size_t 下溢导致越界迭代与潜在内存破坏的安全漏洞。 具体修复: 1. **C++ 算子层**:在 beginAxis = inputNdim - normNdim 计算前增加 TORCH_CHECK(normNdim <= inputNdim),当 normalized_shape 维数大于输入张量维数时直接抛出 RuntimeError,阻断无符号下溢路径。 2. **Python 入口层**:在 mindiesd/layers/norm.py::check_input_params() 中增加 len(layernorm.normalized_shape) > x.dim() 前置校验,使公开 API 路径在调用 C++ 算子前即被拒绝。 3. **Fake Op 层**:在 mindiesd/layers/_custom_ops.py::layernorm_fake() 中同步增加相同维数校验,保持测试 fake 模式与真实算子行为一致。 4. **边界用例测试**:在 tests/layers/test_layernorm.py 和 tests/plugin/test_layernorm.py 中补充 normalized_shape 过大、等于、小于输入维数三类边界测试。 # Test Plan 1. 编译验证:cd build && bash build.sh 2. 运行 layers 层测试:pytest tests/layers/test_layernorm.py -v 3. 运行 plugin 层测试:pytest tests/plugin/test_layernorm.py -v # Test Report - 编译:build.sh 成功 - tests/layers/test_layernorm.py:6 passed(含新增 3 个边界用例)  - tests/plugin/test_layernorm.py:4 passed(含新增 2 个边界用例)  See merge request: Ascend/MindIE-SD!305 | 2 个月前 | |
[Feature][compilation]Fix timing measurement and add MulAdd fusion pattern Co-authored-by: blian6<bin.lian@outlook.com> Co-authored-by: blian<lianbin@huawei.com> # message auto-generated for no-merge-commit merge: !270 merge dev into dev [Feature][compilation]Add muls_add Triton kernel fusion pattern, benchmark utilities, and framework fixes Created-by: blian Commit-by: blian6;blian Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes 修复compilation模块的benchmark方法,并添加triton算子的感知方案 # Purpose 本 PR 包含两部分工作: ## Part A: muls_add Triton kernel 融合 参考 vllm-ascend 的 muls_add 融合方案,将 mul_add_pattern.py 中的代数优化替换为 kernel 级融合: - **新增** mindiesd/layers/triton_utils.py — Triton Ascend 辅助函数,含 _TRITON_ON_ASCEND 运行时检测 - **新增** mindiesd/layers/muls_add.py — muls_add(x, y, scale) 逐元素融合 kernel(Triton 优先 + torch 自动降级),通过 torch.library.custom_op 注册为 torch.ops.mindiesd.muls_add - **重构** mindiesd/compilation/patterns/mul_add_pattern.py — 工厂函数 create(dtype, scale) + PatternBase 静态接口;pattern 从 mul(a,c)+mul(b,c) 改为 x * scale + y;replacement 从 mul(add(a,b),c) 改为 muls_add(x, y, scale) kernel 调用 - **修改** mindiesd/layers/__init__.py — 导出 muls_add - **新增** tests/layers/test_muls_add.py — 13 项 kernel 单元测试(dtype/shape/scale/边界/inplace/device 保真性) - **修改** tests/compilation/patterns/test_mul_add_pattern.py — 适配 2-输入 + scale pattern,仅保留正确性断言(cosine similarity ≥ 2^-7) ## Part B: benchmark 基础设施与框架修复 - **新增** tests/compilation/test_bench_utils.py — 公共 benchmark 函数(warmup + sync + 多迭代 + 后5平均),替代原有不准确的 time.perf_counter() 单次测量 - **修复** 4 个 pattern 测试文件接入新 benchmark,断言改为 compiled_time < original_time: - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py - **修复** passes/__init__.py 中 threading.Lock 误用(threading.Lock() → Lock 实例) - FusionPatterns 新增 enable_mul_add 开关 - passes/__init__.py 新增末尾换行符 - **移除** tests/compilation/test_backend.py(SamplePass 为数学恒等变换,不支持 CPU 运行) # Test Plan ### Kernel 层测试 tests/layers/test_muls_add.py — 13 项,覆盖 float32/float16/bfloat16 三种 dtype × 5 种 shape × 7 种 scale 组合,边界值(scale=0/1/-1),inplace 安全性,device/dtype 保真性,多次调用一致性。 ### Pattern 集成测试 tests/compilation/patterns/test_mul_add_pattern.py — 4 项(bfloat16, float16, float32, 32×8192),验证 torch.compile + MindieSDBackend 全链路,cosine similarity ≥ 2^-7。 ### Benchmark + 注册测试 - tests/compilation/test_pattern_registration.py — enable_mul_add 开关测试 - tests/compilation/test_bench_utils.py — benchmark 工具函数 - tests/compilation/patterns/test_adelayernorm_pattern.py - tests/compilation/patterns/test_gelu_pattern.py - tests/compilation/patterns/test_rmsnorm_pattern.py - tests/compilation/patterns/test_rope_pattern.py ### 远端验证命令 bash python -m pytest tests/layers/test_muls_add.py -v python -m pytest tests/compilation/patterns/ -v python -m pytest tests/compilation/test_pattern_registration.py -v Test Report 环境 Ascend 910B (175.99.1.3), torch 2.8.0, torch_npu 2.8.0, triton_ascend 3.2.0 Kernel 单元测试 13/13 passed, 15 subtests Pattern 集成测试 4/4 passed Benchmark + 注册测试 9/9 passed Triton 硬件 40 vector cores, 20 AI cores See merge request: Ascend/MindIE-SD!270 | 3 个月前 | |
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.path 和 ASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insert和 ASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.py 和 tests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试:  See merge request: Ascend/MindIE-SD!340 | 1 个月前 | |
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.path 和 ASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insert和 ASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.py 和 tests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试:  See merge request: Ascend/MindIE-SD!340 | 1 个月前 | |
UT分类测试 Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !203 merge ut_Classification into dev UT分类测试 Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # 分类UT测试 测试用例划分为三种类型: - 不依赖npu,可以在cpu环境下下运行的测试用例 执行 cd tests/ bash run_test.sh --cpu_only - 依赖npu运行的测试用例 执行 cd tests/ bash run_test.sh --npu_only - 在npu环境下,运行全量测试用例的方式和之前保持一致 执行 cd tests/ bash run_test.sh # 测试报告 运行cpu_only测试用例成功:  运行npu_only测试用例成功:  运行全量测试用例成功:  See merge request: Ascend/MindIE-SD!203 | 4 个月前 | |
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.path 和 ASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insert和 ASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.py 和 tests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试:  See merge request: Ascend/MindIE-SD!340 | 1 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 1 个月前 | ||
| 4 个月前 | ||
| 3 个月前 | ||
| 1 个月前 | ||
| 24 天前 | ||
| 30 天前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 4 个月前 | ||
| 1 个月前 |