-
Notifications
You must be signed in to change notification settings - Fork 15
Openclaw exp #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+617
−75
Merged
Openclaw exp #17
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6ce1492
deep-fin-pre-commit-patch
binary-husky 9707faf
revise openclaw training
binary-husky b6da77f
add illustration
binary-husky f091efc
add better reward for openclaw agent build
binary-husky 2f07daf
Merge branch 'main' into deep-fin-pre-commit-patch
binary-husky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,9 @@ graph TB | |
| C -->|end_episode + reward_14b| S2 | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
Comment on lines
+92
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| **架构说明**: | ||
|
|
||
| - **Swarm Server 1 (端口 10086)**:承载 7B 模型,负责 Agent 1 和 Agent 3 的推理与训练 | ||
|
|
@@ -176,6 +179,8 @@ sequenceDiagram | |
| 4. 将各自的奖励汇报给对应的 Swarm Server | ||
| 5. 两个 Server 独立执行策略梯度更新 | ||
|
|
||
|
|
||
|
|
||
|
Comment on lines
+182
to
+183
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ## 训练曲线 | ||
|
|
||
|  | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # OpenClaw Reward Cheatsheet | ||
|
|
||
| ## Run the test | ||
|
|
||
| ```bash | ||
| cd agentjet/tutorial/opencode_build_openclaw_agent | ||
|
|
||
| # pointwise (default) | ||
| DASHSCOPE_API_KEY=your_key python test_reward.py | ||
|
|
||
| # listwise | ||
| REWARD_MODE=listwise DASHSCOPE_API_KEY=your_key python test_reward.py | ||
| ``` | ||
|
|
||
| ## Run the training endpoint | ||
|
|
||
| ```bash | ||
| # pointwise (default) | ||
| AJET_SWARM_URL=http://localhost:10086 \ | ||
| DASHSCOPE_API_KEY=your_key \ | ||
| REWARD_MODE=pointwise \ | ||
| python fake_vllm_endpoint.py | ||
|
|
||
| # listwise | ||
| AJET_SWARM_URL=http://localhost:10086 \ | ||
| DASHSCOPE_API_KEY=your_key \ | ||
| REWARD_MODE=listwise \ | ||
| python fake_vllm_endpoint.py | ||
| ``` | ||
|
|
||
| ## Reward modes | ||
|
|
||
| | Mode | Description | | ||
| |------|-------------| | ||
| | `pointwise` | Each response scored independently (0.0–1.0) | | ||
| | `listwise` | All responses ranked together (best=1.0, worst=0.0) | | ||
|
|
||
| ## Environment variables | ||
|
|
||
| | Variable | Default | Description | | ||
| |----------|---------|-------------| | ||
| | `REWARD_MODE` | `pointwise` | `pointwise` or `listwise` | | ||
| | `DASHSCOPE_API_KEY` | — | DashScope API key (required) | | ||
| | `JUDGE_MODEL` | `qwen-plus` | Judge model name | | ||
| | `JUDGE_BASE_URL` | DashScope endpoint | Judge model base URL | | ||
| | `AJET_SWARM_URL` | `http://localhost:10086` | Swarm server URL | | ||
| | `NUM_REPEAT` | `4` | GRPO N (responses per query) | |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ | |
| import sys | ||
| sys.path.insert(0, os.path.dirname(__file__)) | ||
|
|
||
| from on_user_submit_new_requests import on_user_submit_new_requests | ||
| from on_user_submit_new_requests import on_user_submit_new_requests, get_query_history | ||
| from on_compute_relative_reward import on_compute_relative_reward | ||
|
|
||
| # Configuration | ||
|
|
@@ -91,6 +91,14 @@ async def proxy_chat_completion(base_url: str, api_key: str, request: Request, i | |
| json_data = await request.json() | ||
| json_data["stream"] = is_stream | ||
|
|
||
| # Remove fields not supported by vLLM to avoid warnings | ||
| UNSUPPORTED_FIELDS = {"strict", "store"} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| for field in UNSUPPORTED_FIELDS: | ||
| json_data.pop(field, None) | ||
| # Also remove 'strict' from response_format if present | ||
| if "response_format" in json_data and isinstance(json_data["response_format"], dict): | ||
| json_data["response_format"].pop("strict", None) | ||
|
|
||
| async with httpx.AsyncClient(timeout=300.0) as client: | ||
| resp = await client.post(f"{base_url}/chat/completions", json=json_data, headers=headers) | ||
| resp.raise_for_status() | ||
|
|
@@ -200,7 +208,7 @@ async def handle_one2many_request(request: Request, request_id: str) -> Dict | L | |
|
|
||
| valid_results = await run_all_episodes(request, is_stream) | ||
| all_answers = [extract_assistant_message(r.response) for r in valid_results] | ||
| rewards = await on_compute_relative_reward(valid_results, all_answers) | ||
| rewards = await on_compute_relative_reward(valid_results, all_answers, question=user_query) | ||
|
|
||
| await finalize_episodes(task, valid_results, rewards) | ||
|
|
||
|
|
@@ -259,7 +267,7 @@ async def health_check(): | |
| @app.get("/requests") | ||
| async def get_requests(): | ||
| """Get all recorded user requests.""" | ||
| return {"requests": USER_REQUEST_RECORD} | ||
| return {"requests": get_query_history()} | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are excessive blank lines here, which can affect the document's readability. It's generally best to use a single blank line to separate paragraphs or elements.