已合并
【feature】统一帮助信息规范 #953
kun_8创建于 23 天前
【feature】统一帮助信息规范 #953
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 kun_8 的贡献)atomgit-bot
23 天前 评论:
23 天前 评论:
变更摘要
该 PR 旨在统一各命令行工具的帮助信息输出格式。核心是新增共享帮助渲染模块 python/msprobe/core/common/cli_help.py,其中定义了 MindStudioArgumentParser(继承自 argparse.ArgumentParser)、HelpSpec 数据类以及 HELP_SPECS 帮助规格表,将帮助信息统一组织为 Description、Usage、Required arguments、Optional arguments、Examples、Output、Troubleshooting 等固定章节,并自动清洗 <Required>、Default path: 等标签、规范参数元变量与默认值展示。随后在 msprobe、msaccucmp、acc_check、anomaly_processor 等各命令行入口用 MindStudioArgumentParser 替换原有的 argparse.ArgumentParser,并为子命令和 msaccucmp 独立打包场景提供适配,使帮助信息风格保持一致。
主要改动
- 新增统一帮助渲染模块:
python/msprobe/core/common/cli_help.py新增MindStudioArgumentParser、HelpSpec、HELP_SPECS及format_help()等实现,统一生成分章节的 CLI 帮助文本,并集中维护各命令的描述、用法、示例与输出说明。 - 各 CLI 入口替换解析器:
msprobe.py、acc_check_cli.py、anomaly_processor.py、data_conversion.py、shape_format_conversion.py、dump_parser.py、inplace_layer_process.py、msaccucmp.py、mscmp_advisor.py、vector_comparison.py以及 PyTorch 侧的acc_check、multi_acc_check、run_overflow_check、api_precision_compare、gen_model_config均改用MindStudioArgumentParser,并显式传入prog以匹配统一帮助规格。 - 子命令接入统一渲染:
msprobe.py、dump_parser.py、msaccucmp.py通过add_subparsers(..., parser_class=MindStudioArgumentParser)使子命令也使用统一帮助布局。 - msaccucmp 独立打包适配:新增
python/msprobe/msaccucmp/cli_help.py适配器,通过importlib动态加载共享渲染模块;各转换/比较脚本使用try/except ImportError回退到本地cli_help,同时scripts/build_msaccucmp.sh在打包时复制cli_help.py以解除对完整msprobe包的依赖。 - 新增帮助格式单元测试:
test/msprobe_test/core_ut/common/test_cli_help.py验证章节顺序、参数元变量、默认值展示以及<Required>、Default path:等标签的清洗行为。


不准确?
AtlasAccount
23 天前 评论:
23 天前 评论:
atomgit-bot
23 天前 评论:
23 天前 评论:
23 天前 添加了label:stat/needs-squash
23 天前 添加了label:ascend-cla/yes
此处折叠了123条消息 查看更多
19 天前 添加了label:approvedlgtm
19 天前 合入了pull request
ascend-robot
19 天前 评论:
19 天前 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


统一msprobe下命令行-h的输出格式,具体格式如下图所示