Pull Request已成功合入, 合并人@ascend-robot
(感谢 wanglijun55 的贡献)变更摘要
本 PR 将 master 分支 #44119 的告警日志英文质量修复同步至 v2.10.0 分支,对 torch_npu 全仓 UserWarning / logger.warning / logger.info / print 等日志消息中的英文语法、拼写、标点与措辞进行系统性修正,同时顺带清理了部分冗余格式与字符串拼接问题,不涉及任何功能逻辑、接口或资料变更。
主要改动
-
日志消息英文语法与措辞规范化: 修复语法错误(如
will not to be linked→will not be linked、should to be initialized→should be initialized、Create ... failed→Failed to create ...)、逗号拼接句拆分/改用分号、补充缺失冠词(in future version→in a future version)、主谓一致(Environment variable ... is not set→are not set、There is no ... events→There are no ... events)并统一补充缺失句号,涉及torch_npu/asd/asd.py、torch_npu/npu/utils.py、torch_npu/npu/npu_config.py等文件。 -
术语与拼写统一: 将
soft chain统一改为symbolic link(torch_npu/utils/_path_manager.py、torch_npu/profiler/analysis/prof_common_func/_path_manager.py、torch_npu/utils/collect_env.py),拼写修正Detecct_type→Detect_type、Torchinductor→TorchInductor、Can not→Cannot、func→function,并将for replacement改为as a replacement(iou.py、activations.py、fusedcolorjitter.py等弃用提示)。 -
去除冗余前缀与标点/拼接问题修复: 移除
warnings.warn()中重复的Warning:前缀(如asd.py、torch_npu/utils/_step.py中 NPU_ASD_CONFIG 系列提示),将中文顿号、改为英文逗号(torch_npu/npu/_backends.py),并修复相邻字符串缺少空格导致消息粘连的问题(gemm_autotune.py、torch_npu/_inductor/__init__.py、npu/utils.py)。 -
日志格式化方式优化: 将
loggerSilent.debug/info/warning、self.logger.warning等处的 f-string 拼接改为%s惰性参数化模板(asd.py、torch_npu/utils/_step.py、_cann_file_parser.py、_fwk_file_parser.py),并用logger.exception替代logger.error(..., exc_info=True)(_kernel_view_parser.py、_basic_db_parser.py),使日志记录更规范、便于延迟求值。 -
日志消息内容 Bug 修复:
torch_npu/utils/serialization.py中_npu_legacy_save的warn_massage由逗号拼接的 tuple 修正为单个字符串;torch_npu/utils/npu_intercept.py中无占位符的 f-string(print(f"Warning : ..."))改为普通字符串,避免无效格式化。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
| torch_npu/_inductor | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
| torch_npu/contrib/transfer_to_npu.py | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
| torch_npu/npu | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
| torch_npu/profiler | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wanglijun55, thanks for your pull request. All authors of the commits have signed the CLA. 👍


当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.7.1-26.1.0 | ||
| v2.12.0 | ||
| v2.11.0 | ||
| v2.7.1 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.9.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| v2.11.0-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| ci-test |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| Build_X86_213 | 🛑 | >>> | |
| Build_ARM_213 | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| check_error | ✅ | >>> | |
| lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_ARM_A3_Part_01 | 🛑 | >>> |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | ✅ | >>> | |
| UT_inductor_Part_02 | ✅ | >>> | |
| UT_inductor_Part_03 | ✅ | >>> | |
| UT_inductor_Part_04 | ✅ | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_213 | 🛑 | >>> | |
| UT_inductor_Part_213 | 🛑 | >>> | |
| UT_DIST_ARM_Part_213 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_213 | 🛑 | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


compile


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| Build_X86_213 | 🛑 | >>> | |
| Build_ARM_213 | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| check_error | ✅ | >>> | |
| lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_ARM_A3_Part_01 | 🛑 | >>> |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | ✅ | >>> | |
| UT_inductor_Part_02 | ✅ | >>> | |
| UT_inductor_Part_03 | ✅ | >>> | |
| UT_inductor_Part_04 | ✅ | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_213 | 🛑 | >>> | |
| UT_inductor_Part_213 | 🛑 | >>> | |
| UT_DIST_ARM_Part_213 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_213 | 🛑 | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


/approve


/lgtm




【合入来源】
同步自 master 分支 PR #44119(refactor: correct English grammar, spelling, and style in log/warning messages)。
【修改方案】
将 PR #44119 在 master 分支上的告警日志英文语法/拼写修复同步至 v2.10.0 分支。
对 torch_npu 全仓 UserWarning / logger.warning / print 日志中的英文消息进行语法、拼写、标点审查和修复。共涉及 37 个文件,涵盖以下类别:
will not to be linked→will not be linked、should to be initialized→should be initialized、Create ... failed→Failed to create ...等Detecct_type→Detect_typein future version→in a future version、only sets Global variable→only sets the global variableEnvironment variable ... is not set→are not set、There is no ... events→There are no ... events、→ 英文逗号、多余空格、缺失句号、相邻字符串缺少空格拼接导致粘连soft chain→symbolic link(软链接)warnings.warn()中重复的Warning:前缀serialization.py—print()传入 tuple 而非 stringfor replacement→as a replacement、Torchinductor→TorchInductor、Can not→Cannot、func/msg→function/message等注:master PR 中对
test/unsupported_test_cases/.pytorch-disabled-tests.json的修改为测试配置更新,与告警日志修复无关,不在本次同步范围内。【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
仅修改日志/警告消息字符串,不影响任何功能逻辑。所有修改均为:
【CheckList】