mindspore-ai / mindspore-ai/hyper-parallel

Trainer串讲问题汇总

Open
#854 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
53
Forks
63
Avg merge
23h 45m
Merged PRs (30d)
63

Description

1. resolver.py / manager.py 职责划分不清
  • 建议:两个文件职责混杂,可拆成"只对接用户输入部分"与"负责解析"两部分。
  • 处理:入口部分(parse_training_args、YAML 加载、CLI override 写回)独立成 parser.py;解析部分(YAML 节点 → 带类型的配置对象、dotted override、报错)全部收在 resolver.py,内部分三节:值归一化 / dotted override / 节点解析。
2. manager.py 重命名
  • 建议:文件名与职责对不上,重命名为 parse.py
  • 处理:改为 parser.py;7 处调用方的 import 由 config.manager 迁移到 config.parser
3. _fail 函数抽象不必要
  • 建议_fail 只是"拼前缀 + 抛异常"的中转,减少这层单独抽象。
  • 处理:path 前缀收进 ConfigResolutionError 自身,删除 _fail,原 36 处 raise _fail(...) 与 13 处手写构造改为直接 raise;异常类型与消息逐字不变。
4. resolve_root 重命名
  • 建议:名字无法表达职责。
  • 处理:改为 resolve_config,与同族的 resolve_component 对齐,语义是"将 YAML 节点解析成带类型的配置对象"。
5. coerce_* 一族统一命名
  • 建议coerce_* 命名风格不统一,用词偏僻难以理解。
  • 处理:统一为 normalize_*coerce_valuenormalize_value_coerce_*_normalize_*);边界为 resolve_* 接收 YAML 节点,normalize_* 只对已解析的值做校验与转换。
6. Target(Generic[_T]) 的含义
  • 建议/问题Generic[_T] 这个泛型参数表示什么。
  • 回答_T 是被包装 callable 的返回类型(Target.callable -> Callable[..., _T]),只参与类型注解与静态检查,运行时不参与;Target 本身只是_target_ 的薄封装加构造期校验。
7. README / docs 中 AutoModels 命名
  • 建议AutoModels 已废弃,需改名。
  • 处理:全部改名,统一为 HyperParallel 模型训练 / 训练配置与组件 / 二次开发指南,仓库内不再出现 AutoModels
8. TrainerConfig 的 dataclass 参数散落(本次未涉及)
  • 建议TrainerConfig 组合用的 config 类是否应集中到 trainer/config/ 下。
  • 处理:本次未涉及;当前来源为 models/build_options.pyCompileConfigFSDP2Config)、components/checkpoint/config.pyCheckpointingConfig)、components/quantization/config.pyLowPrecisionConfig),引用点 trainer/config/trainer.py:24-25__init__.py:45-46training.py:24;是否收拢待定。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read resolver.py, manager.py, and the seven config.manager import sites, then inspect the documented config classes and references in trainer/config/trainer.py, init.py, and training.py. Done means the parser/resolver split, renames, direct error raising, and documentation naming changes are consistent; TrainerConfig consolidation remains explicitly out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.