feat(#424): 接入 reward 训练 HTTP 路由与 server 启动装配 - #429
Merged
Conversation
补齐 PR #427 缺失的对外暴露层: - fine_tune_route.py: 新增 /admin/api/fine-tune/reward/jobs 的 create/list/get/cancel/delete 五个路由 + set_reward_context / _get_reward_service / _create_reward_job 共享辅助,校验 model_id 与 preference_pairs[{prompt,chosen,rejected}] schema。 - server.py: 启动期实例化 RewardService 单例,经 set_reward_context 注入 engine pool 与 event loop,镜像 DPO 装配块。 端到端验证(真实 Qwen3-0.6B-4bit, 4 iters): status=completed, loss 0.69→0.0003, reward_margin 7.98, acc_chosen 1.0, adapter 写盘 (reward_model=true)。 14 项 reward route 单测全绿。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
背景
#424 reward-model 训练。PR #427 已落地
reward_service.py+ 14 项 route/service 单测,但单测 import 的路由处理函数此前未提交进fine_tune_route.py,server 启动也未装配RewardService,导致对外 HTTP 端点缺失。本 PR 补齐这层。改动
fusion_mlx/admin/fine_tune_route.pyset_reward_context(pool, service=None)/_get_reward_service()/_create_reward_job(request_body)共享辅助POST/GET/GET{id}/POST cancel/DELETEon/admin/api/fine-tune/reward/jobsmodel_id与preference_pairs[{prompt,chosen,rejected}]schemafusion_mlx/server.pyRewardService单例,经set_reward_context注入 engine pool + event loop,镜像 DPO 装配块端到端验证(真实模型)
Qwen3-0.6B-4bit, 3 个 preference pairs, 4 iters:测试
pytest tests/ -k reward→ 17 passed, 7 skippedpytest tests/ -k "reward and route"→ 14 passed (test_reward_route.py)ruff check/black --check→ cleanCloses #424
🤖 Generated with Claude Code