docs: 同步 architecture/inference/training 文档至实际代码,CLI 补充 fsdp 选项

- 修正 ProtocolHandler 架构:concrete + ResponseBuilder(ABC) 策略模式
- 修正训练循环 scheduler.step() 在 sync_gradients 块内
- 修正组合/聚合关系:注入组件改为 o--,删除不持有引用的关联
- --parallel_mode CLI choices 加入 fsdp
- nprocs > 1 且 parallel_mode=none 时 raise error
This commit is contained in:
2026-05-26 19:37:00 +08:00
parent b558e61f63
commit 836e02a166
6 changed files with 80 additions and 66 deletions
+2 -3
View File
@@ -82,8 +82,7 @@ on_train_begin
on_optimizer_step
optimizer.step()
optimizer.zero_grad()
scheduler.step() # called every iteration
scheduler.step()
on_epoch_end
on_train_end
```
@@ -190,7 +189,7 @@ context = (
```
- Loads checkpoint weights if provided
- Creates executor via `ExecutorFactory.create(parallel_mode, **executor_kwargs)`
- Creates executor via `ExecutorFactory.create(cfg.parallel_mode, grad_accum_steps=cfg.grad_accum_steps, **cfg.executor_kwargs)`
- Calls `executor.prepare(model, optimizer, dataloader, scheduler)` for model distribution (e.g. DDP) + gradient accumulation wrappers
- Creates `ResumableDistributedSampler` for shuffle+resume
- Builds strategy via `StrategyFactory.create(train_type, ...)`