Merged
fix: replace Chinese log messages with English in examples #4883
wangyuchenAdd on Sep 10
fix: replace Chinese log messages with English in examples #4883
Merged
wangyuchenAdd on Sep 10
wangyuchen
wangyuchenCollaborators
Sep 10

Description

Replace Chinese log/print messages with English across all examples/ subdirectories to comply with the "no Chinese in logs" rule. Also fix one implicit string concatenation bug (missing space) and improve the English fluency of a previously awkward translation.

Changes

examples/es/ (183 issues, 30 files)

  • C++ main.cpp files (14 subdirs): "GE 初始化失败" → "GE initialization failed", "执行结束" → "Execution completed", "错误: 未知命令" → "Error: unknown command"
  • Python run_graph() (16 files): all Chinese print statements replaced with fluent English ("图运行成功" → "Graph executed successfully", "清理GE环境" → "Cleaning up GE environment", etc.)
  • hccl_ep/hccl_tp: "单卡模式"/"多卡模式" → "Single-card mode"/"Multi-card mode"

examples/fusion_pass/ (68 issues, 12 files)

  • RuntimeError messages: ES API missing prompts translated from Chinese to English with proper README section references
  • Pass registration messages: "已注册" → "registered", "请通过 ASCEND_GE_PY_PASS_PATH 指向本文件" → "Please add this file to ASCEND_GE_PY_PASS_PATH" (improved translation per review feedback)
  • Graph base pass and pattern base pass: all Chinese print/log replaced

examples/multi_stream_autotune/ (73 issues, 3 files)

  • ge_ms_autotune.py: ~110 Chinese log/error/print messages replaced; header and column labels in output table anglicized; docstrings updated
  • sample_run.py: Chinese comments and print statements replaced
  • README.md / README_en.md: example output section updated to match new English outputs
  • Fixed missing space bug in find_compiled_om() string concatenation

examples/offline_compile_run/ (70 issues, 10 files)

  • C++ files: all std::cerr/std::cout Chinese messages replaced ("失败" → "failed", "初始化成功" → "initialized successfully", etc.)
  • Python files: all Chinese print/f-string messages replaced with English equivalents

Change Statistics

  • 56 files modified
  • 467 insertions, 442 deletions
  • 394 Chinese log messages converted to English across 4 module directories

Change Type

How to Test

  1. Build any example under examples/ and verify all output messages are in English
  2. Check examples/multi_stream_autotune/ outputs for proper formatting

Checklist

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for wangyuchen's contribution.)
wangyuchenwangyuchenCollaborators
Sep 10 Created pull request, commit 37dabb7b
atomgit-bot
atomgit-bot
Sep 10 Comments:

变更摘要

该 PR 旨在落实"日志中不得出现中文"的规则,将 examples/ 下 es、fusion_pass、multi_stream_autotune、offline_compile_run 四个模块目录中的全部中文日志/打印消息替换为英文,同时修复了 ge_ms_autotune.py 中一处字符串拼接缺空格的缺陷,并按评审意见改进了一处译文的英文流畅度。

主要改动

  • examples/es/ 目录日志英文化: C++ 示例 main.cpp 中的错误与状态消息(如 "GE 初始化失败" → "GE initialization failed"、"执行结束" → "Execution completed"、"错误: 未知命令" → "Error: unknown command"),以及 Python 示例 run_graph() 中的全部 print 消息(如 "图运行成功" → "Graph executed successfully!"、"清理GE环境" → "Cleaning up GE environment...")均替换为英文。
  • examples/fusion_pass/ 目录提示消息英文化: ES API 缺失时的 RuntimeError 提示(如 "未找到 ge.es.math.ConcatV2" → "ge.es.math.ConcatV2 not found")与 Pass 注册打印消息("已注册" → registered、"请通过 ASCEND_GE_PY_PASS_PATH 指向本文件" → "Please add this file to ASCEND_GE_PY_PASS_PATH")翻译为英文,并补充了对 README 中 'Handling Missing ES APIs (Optional)' 等章节的引用。
  • examples/multi_stream_autotune/ge_ms_autotune.py 全面英文化并修复缺陷: 约 110 条日志/错误/打印消息替换为英文,结果汇总表表头与列标签(如 "配置" → config、"结论" → verdict)及 docstring 同步更新;同时修复了 find_compiled_om() 中字符串拼接缺空格的问题(",同目录下只有上一轮的 {}" → ", only leftovers from the previous run found in this directory: {}")。
  • examples/offline_compile_run/ 目录日志英文化: C++ 文件的 std::cerr/std::cout 消息(如 "失败" → failed、"系统初始化成功" → "System initialized successfully")与 Python 文件的 print/f-string 消息均替换为英文,涉及 build_bundle_model、run_bundle_model、build_add_model、run_add_model 等脚本。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 10 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robot
CANN-robotCollaborators
Sep 10 Comments:

Warning

The PR commit(s) can not be got, please check it!

likedislike
CANN-robot
CANN-robotCollaborators
Sep 10 Comments:

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.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/ge ✅ yangyongqiang0606, Mexyy, ClarkXie (3/2) ✅ yangyongqiang0606 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

yuchen97, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
65 messages are collapsed here。 See more
ClarkXie
ClarkXieCollaborators
Sep 10 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 10 Added label: lgtm
yangyongqiang
yangyongqiangCollaborators
Sep 10 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 10 Added label: approved
CANN-robotCANN-robotCollaborators
Sep 10 Merged pull request