Pull Request已成功合入, 合并人@ascend-robot
(感谢 wanglijun55 的贡献)变更摘要
此 PR 对 torch_npu 全仓 37 个文件中的英文日志/警告消息进行了系统性的语法、拼写、标点和风格审查与修复,共涉及约 48 处错误。修复范围涵盖:语法错误(如 will not to be linked → will not be linked)、术语规范化(soft chain → symbolic link)、warnings.warn() 中冗余的 Warning: 前缀移除、中文顿号替换为英文逗号、以及 serialization.py 中因逗号误用导致 warn_massage 被构建为 tuple 而非 string 的代码缺陷修复。所有修改仅限字符串文本,不影响功能逻辑。
主要改动
-
语法错误修复:修正了多处不当的
to插入(如will not to be linked→will not be linked、should to be initialized→should be initialized),并将Can not统一为Cannot(涉及npu_static_kernel.py、asd.py、npu/utils.py、prof_common_func/_path_manager.py、prof_db_parse/_basic_db_parser.py等) -
术语与风格规范化:将
soft chain(软链)统一修正为symbolic link(涉及_path_manager.py(profiler/analysis)、utils/_path_manager.py、utils/collect_env.py);将Torchinductor修正为TorchInductor;将func/msg展开为function/message(mstx.py);将弃用警告中的for replacement统一改为as a replacement(iou.py、activations.py、fusedcolorjitter.py等) -
serialization.py中 tuple→string 修复:_npu_legacy_save中warn_massage原本因相邻字符串间误用逗号拼接而被构建为 tuple,修复后将三个字符串正确拼接为单一 string,作为_warn_legacy_serialization的参数 -
标点与格式修正:将中文顿号替换为英文逗号(
flash、math、mem_efficient→flash, math, mem_efficient,_backends.py);修复缺少空格导致字符串粘连(reprs -"→reprs - ",ascend_npu_ir/npu/utils.py);将逗号拼接的两个独立句子拆分为两句(__init__.py、transfer_to_npu.py);为多处警告消息补全缺失的句号(npu/__init__.py、_graph_tree.py) -
冗余前缀与主谓一致修复:移除
warnings.warn()消息中重复的Warning:前缀(asd.py、utils/_step.py);修正主谓不一致(There is no ... events→There are no ... events,prof_parse/_cann_file_parser.py;Environment variable ... is not set→are not set,npu/utils.py);补全缺失冠词(in future version→in a future version,涉及warning_patches.py、fused_attention.py、linear_a8w8_quant.py、npu_config.py)




/sync v2.12.0 v2.11.0 v2.9.0 v2.7.1


In response to this:
/sync v2.12.0 v2.11.0 v2.9.0 v2.7.1
同步操作执行结果:
| Branch | Status | Pull Request |
|---|---|---|
| v2.12.0 | 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况 | |
| v2.11.0 | 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况 | |
| v2.9.0 | 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况 | |
| v2.7.1 | 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况 |


【合入来源】
【修改方案】
对 torch_npu 全仓 UserWarning / logger.warning / print 日志中的英文消息进行语法、拼写、标点审查和修复。共修复 48 处错误,涉及 39 个文件,涵盖以下类别:
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:672—print()传入 tuple 而非 stringfor replacement→as a replacement、Torchinductor→TorchInductor、Can not→Cannot、func/msg→function/message等【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
仅修改日志/警告消息字符串,不影响任何功能逻辑。所有修改均为:
【CheckList】