已合并
refactor: correct English grammar, spelling, and style in log/warning messages #44119
wanglijun55创建于 8月8日
refactor: correct English grammar, spelling, and style in log/warning messages #44119
已合并
wanglijun55创建于 8月8日
wanglijun55成员
8月8日

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)
https://gitcode.com/Ascend/pytorch/issues/3908

【修改方案】

对 torch_npu 全仓 UserWarning / logger.warning / print 日志中的英文消息进行语法、拼写、标点审查和修复。共修复 48 处错误,涉及 39 个文件,涵盖以下类别:

  1. 语法错误 (14处): will not to be linkedwill not be linkedshould to be initializedshould be initializedCreate ... failedFailed to create ...
  2. 逗号拼接句 (8处): 将逗号连接的两个独立句子拆分为两句或使用分号
  3. 拼写错误 (1处): Detecct_typeDetect_type
  4. 缺少冠词 (7处): in future versionin a future versiononly sets Global variableonly sets the global variable
  5. 主谓不一致 (5处): Environment variable ... is not setare not setThere is no ... eventsThere are no ... events
  6. 标点/格式 (8处): 中文顿号 → 英文逗号、多余空格、缺失句号、相邻字符串缺少空格拼接导致粘连
  7. 翻译不当 (2处): soft chainsymbolic link(软链接)
  8. 冗余前缀 (2处): warnings.warn() 中重复的 Warning: 前缀
  9. 代码 Bug (1处): serialization.py:672print() 传入 tuple 而非 string
  10. 风格问题: for replacementas a replacementTorchinductorTorchInductorCan notCannotfunc/msgfunction/message

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

仅修改日志/警告消息字符串,不影响任何功能逻辑。所有修改均为:

  • 英文语法/拼写/标点修正
  • 字符串拼接 bug 修复(serialization.py tuple → string)
  • 翻译术语规范化(soft chain → symbolic link)

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 wanglijun55 的贡献)
Wwanglijun55成员
8月8日 创建了 pull request,commit 354cd154
atomgit-bot
atomgit-bot
8月8日 评论:

变更摘要

此 PR 对 torch_npu 全仓 37 个文件中的英文日志/警告消息进行了系统性的语法、拼写、标点和风格审查与修复,共涉及约 48 处错误。修复范围涵盖:语法错误(如 will not to be linkedwill not be linked)、术语规范化(soft chainsymbolic link)、warnings.warn() 中冗余的 Warning: 前缀移除、中文顿号替换为英文逗号、以及 serialization.py 中因逗号误用导致 warn_massage 被构建为 tuple 而非 string 的代码缺陷修复。所有修改仅限字符串文本,不影响功能逻辑。

主要改动

  • 语法错误修复:修正了多处不当的 to 插入(如 will not to be linkedwill not be linkedshould to be initializedshould be initialized),并将 Can not 统一为 Cannot(涉及 npu_static_kernel.pyasd.pynpu/utils.pyprof_common_func/_path_manager.pyprof_db_parse/_basic_db_parser.py 等)

  • 术语与风格规范化:将 soft chain(软链)统一修正为 symbolic link(涉及 _path_manager.py(profiler/analysis)、utils/_path_manager.pyutils/collect_env.py);将 Torchinductor 修正为 TorchInductor;将 func/msg 展开为 function/messagemstx.py);将弃用警告中的 for replacement 统一改为 as a replacementiou.pyactivations.pyfusedcolorjitter.py 等)

  • serialization.py 中 tuple→string 修复_npu_legacy_savewarn_massage 原本因相邻字符串间误用逗号拼接而被构建为 tuple,修复后将三个字符串正确拼接为单一 string,作为 _warn_legacy_serialization 的参数

  • 标点与格式修正:将中文顿号替换为英文逗号(flash、math、mem_efficientflash, math, mem_efficient_backends.py);修复缺少空格导致字符串粘连(reprs -"reprs - "ascend_npu_ir/npu/utils.py);将逗号拼接的两个独立句子拆分为两句(__init__.pytransfer_to_npu.py);为多处警告消息补全缺失的句号(npu/__init__.py_graph_tree.py

  • 冗余前缀与主谓一致修复:移除 warnings.warn() 消息中重复的 Warning: 前缀(asd.pyutils/_step.py);修正主谓不一致(There is no ... eventsThere are no ... eventsprof_parse/_cann_file_parser.pyEnvironment variable ... is not setare not setnpu/utils.py);补全缺失冠词(in future versionin a future version,涉及 warning_patches.pyfused_attention.pylinear_a8w8_quant.pynpu_config.py

likedislike
不准确?
atomgit-bot
atomgit-bot
8月8日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
ascend-robotascend-robot成员
8月8日 添加了label:ascend-cla/yes
此处折叠了260条消息 查看更多
ascend-robotascend-robot成员
26 天前 关闭了关联的issue
ascend-robotascend-robot成员
26 天前 合入了pull request
ascend-robot
ascend-robot成员
26 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#13890 [ commitID:da771b6f ] 运行失败
likedislike
wanglijun55成员
26 天前 评论:

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

likedislike
ascend-robot
ascend-robot成员
26 天前 评论:

In response to this:

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

@wanglijun55

同步操作执行结果:

Branch Status Pull Request
v2.12.0 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况
v2.11.0 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况
v2.9.0 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况
v2.7.1 同步失败:请手动创建 PR 进行同步,我们会继续完善分支之间同步操作,尽量避免同步失败的情况
likedislike