mindspore-ai / mindspore-ai/hyper-parallel
Trainer串讲问题汇总
Open
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_value→normalize_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.py(CompileConfig、FSDP2Config)、components/checkpoint/config.py(CheckpointingConfig)、components/quantization/config.py(LowPrecisionConfig),引用点trainer/config/trainer.py:24-25、__init__.py:45-46、training.py:24;是否收拢待定。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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