Tools 优化:重构并完善 PaddleAPITest 工具库及文档#643
Open
cangtianhuang wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 对
tools/目录下的公用工具进行了全面的重构和优化,主要包括:代码质量提升
argparse参数解析,统一parse_args()和main(argv)函数签名collect_input_files,read_config_set,backup_file等)以改善代码复用性--no-backup等备份控制选项,提高工具灵活性parse_args()方法便于单元测试和脚本复用文件组织优化 - 功能性重构
配置集合工具(extract/merge/compare/retrieve):
get_api_set.py→extract_api_set.py(从配置文件提取 API 名集合)get_config_set.py→merge_config_set.py(合并/去重/排序配置集合)get_diff_config_set.py→diff_config_set.py(对比两个配置集合的差异)retrieve_configs.py→retrieve_config_set.py(按关键词从配置文件召回配置)配置移除工具(remove/delete):
remove_configs.py→remove_config_set.py(完全重写,支持备份/回退/精简备份目录等高级功能)remove_case_by_api.py→remove_lines_by_keyword.py(按关键词删除匹配行)retest_remover.py→remove_retest_configs.py(从 checkpoint 移除指定类型配置)API 用例提取工具(extract cases):
get_cases_from_csv.py→extract_cases_from_csv.py(从 CSV 中按 API 名提取用例)move_config.py→extract_or_remove_api_cases.py(按 API 提取或删除配置用例)日志处理工具(新增):
seek_skip_configs.py(从 checkpoint 中扣除终态日志,生成 skip 配置)shrink_large_configs.py(针对大 Tensor 配置缩小 shape,用于回归)错误统计工具重构
error_stat/error_stat.py- 增强日志整理功能Too large tensor to get cached numpy,There is no grad op for inputs:)parse_args()和main(argv)接口error_stat/csv_stat_stable.py- 优化精度统计paddle._C_ops._run_custom_op()中的具体操作名--chunk-size和--max-workerserror_stat/csv_stat_tol.py- 对标 stable.py 进行对应优化完整文档补充
tools/README.md- 完整工具使用指南各文件功能说明
extract_api_set.pymerge_config_set.pydiff_config_set.pyretrieve_config_set.pyremove_config_set.pyextract_cases_from_csv.pyextract_or_remove_api_cases.pyremove_lines_by_keyword.pyremove_retest_configs.pyseek_skip_configs.pyshrink_large_configs.pyerror_stat/error_stat.pyerror_stat/csv_stat_stable.pyerror_stat/csv_stat_tol.py修改统计
remove_config_set.py从基础版本重写为支持备份/回退/精简的高级版本tools/README.md完整工具使用指南关键改进
✅ 统一命令行接口设计(
parse_args()和main(argv)可选参数)✅ 代码复用性提升,减少重复逻辑
✅ 统一的参数解析、错误处理、日志输出风格
✅ 高级功能支持(备份/回退/精简、custom_op 识别、并行处理等)
✅ 清晰完整的使用文档与示例