Repository navigation
feat(opd): support multi-node teacher and rollout engines in MultiEngineManager - #450
Conversation
|
Thanks for contributing to Relax, @DrRyanHuang! 感谢你为 Relax 做出贡献! 📚 Contribution guide / 贡献指南Describe the problem, your changes, and how you validated them. Keep each PR focused and run 请说明问题、改动和验证方式,保持 PR 聚焦,并在提交前运行 🛠️ CI commands / CI 指令
Put one command on the first line of a new PR comment. Rerun/cancel require PR authorship or repository write access. 在新 PR 评论的首行写一条指令。PR 作者或有仓库写权限的贡献者可以重跑、取消 CI。 🔎 Merge requirements / 合入条件GitHub:⏳ 合入条件未满足
|
Nyanpasu 审查看板审查状态: ✅ 已通过 审查版本: 7213496 目标分支: main 复审通过:72134963 相对已审 6b35b53 只更改两个测试文件,原可选 SGLang 依赖问题已修复,未发现新增问题。Python 3.12.3 下选取两项地址分配测试及 node_rank=1 的启动测试,共 3 项通过;本地环境已安装 SGLang,该结果仅验证模拟调用与 fixture 注册,未复现完整 CPU CI 环境。新 head 的格式检查已通过,其他 CI 尚未全部完成。真实多节点 GPU/Ray/NCCL 启动与恢复未经本次验证。
审查发现待处理
已解决或已取代
提交范围 · 接收 6 · 建议移出 0 · 待确认 0接收 6 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
Powered by Nyanpasu with gpt-6.1-sol xhigh, please check the suggestions carefully.
|
||||||||||||||||||||||||||||||||||||||||||||
…ineManager ✨ Feature - Support multi-node logical engines (`nodes_per_engine >= 1`) across MultiEngineManager and TeacherManager for large teacher models (e.g., TP=16+ across multiple nodes). - Dedicated Placement Groups: Create one multi-node PG per replica owned by the head slot, shared across follower slots. - Grouped Address Allocation: Group ranks by replica (`rank // nodes_per_engine`) so all nodes in a replica share the head node's IP for distributed initialization (`dist_init_addr`). - Route & Lifecycle Isolation: Restrict external HTTP endpoints (`get_urls()`), health checks (`health_check()`), and memory offload/onload (`_fanout`) to head nodes only, preventing direct requests to internal follower nodes. - Atomic Retirement & Safe Rollback: Retire all slots of a multi-node replica together on failure; ensure follower actors are stopped before removing owned placement groups. ✅ Tests - tests/backends/sglang/test_sglang_engine.py: Verify multi-node dist_init_addr and worker init. - tests/distributed/ray/test_multi_engine_manager.py: Verify multi-node engine lifecycle, fanout, retirement, and graceful rollback. - tests/distributed/ray/test_teacher_manager.py: Verify multi-node PG sharing, replica address bundling, head-only routing/memory ops, and single-node separation.
rai-studio-bot
left a comment
There was a problem hiding this comment.
评审结论
已完成 6b35b538 的节点放置、地址分配、整组回收与恢复、进程生命周期及对应测试审查;保留一项测试兼容性意见。未确认生产代码的阻塞缺陷;本次依据源码和现有 CI 日志,未执行真实多节点 GPU/NCCL 集成验证。
6b35b53 to
7213496
Compare
…rence Conflicts (modify/delete) with redai-studio#450, which extended MultiEngineManager and TeacherManager for multi-node teacher replicas. This branch removed both: Teacher and GenRM engines now start through start_servers/EngineGroup on the InferenceManager, which already covers redai-studio#450's requirements: - multi-node replicas must use whole nodes (InferenceModelSpec.resolved, teacher_role_model); - URLs, health probes and memory operations reach replica heads only (EngineGroup.engines, RolloutServer._call_heads; followers answer health_generate locally); - a dead replica is retired as a whole (RolloutServer._retire); - one placement group per model, with the planner checking each node slot. The deletions are kept. redai-studio#450's SGLangEngine change (parent-death guard, follower process handle) merged cleanly. Its behaviours are re-covered by tests against the unified pool in test_rollout_inference_pool.py.

What
MultiEngineManager与TeacherManager管理跨物理节点的多机模型实例(nodes_per_engine >= 1,如 TP=16+ 跨 2 台 8 卡机器)。rank // nodes_per_engine分组,确保从节点正确定位并连接到本 Replica Head 的dist_init_addr。get_urls()、health_check()、onload()、offload()仅下发给各 Replica 的 Head 节点,不对内部 Follower 暴露。Why
在使用大模型作为 Teacher(如 72B / 397B 等需要多机 TP=16+ 部署)进行 On-Policy Distillation (OPD) 时,之前的
MultiEngineManager假定 1 个 Slot 等于 1 个单机 Engine。这会导致:How
1.
MultiEngineManager:nodes_per_engine属性,self.engines属性切片为[::nodes_per_engine](仅返回 Head 节点)。_fanout仅向各个 Head 节点广播显存操作(release_memory_occupation/resume_memory_occupation)。_retire_engines计算各 slot 对应 logical engine 的 head 并批量下线整组节点。shutdown确保先清理 Follower slots 避免 Actor 悬空,再清理 owned PG。2.
TeacherManager:gpus_per_replica % num_gpus_per_node == 0)。_resolve_placement中仅rank % nodes_per_engine == 0的 Head 槽位创建并持有 PG,Follower 槽位借用。_allocate_engine_addr_and_ports按 Replica 分组调用地址分配器,保证同一模型下的所有节点使用同一个 Head 地址及连续端口。3.
SGLangEngine:_start_server支持传入worker_type及对应的dist_init_addr,以便 Follower 节点连接 Head。Testing
pre-commit run --all-filespassespytest tests/)测试命令及结果:
pytest tests/backends/sglang/test_sglang_engine.py tests/distributed/ray/test_multi_engine_manager.py tests/distributed/ray/test_teacher_manager.py # 47 passed in 0.89sType of Change