-
Notifications
You must be signed in to change notification settings - Fork 45
Support swanlab as logger #359
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
Open
binary-husky
wants to merge
17
commits into
modelscope:main
Choose a base branch
from
binary-husky:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6a63cbd
support swanlab
binary-husky e2bce75
stage for astune
binary-husky fc419b7
compat swanlab
binary-husky 42a8567
stage for astune
binary-husky 4564a66
improve according to suggestions
binary-husky 36df4c8
repo merge stage 1
binary-husky de22b8b
rename
binary-husky dc2e63a
astune compat
binary-husky c3d094d
Merge remote-tracking branch 'oorigin/main'
binary-husky f9b6b5d
patch
binary-husky 54bf2fc
patch import
binary-husky 7b1af16
patch type chheck
binary-husky c18e3cd
fix import
binary-husky 6976097
refactor: change AstuneTaskReader to inherit from TaskFileReader
binary-husky e32e642
Merge remote-tracking branch 'oorigin/main' into merge_new
binary-husky 82ba92e
fix
binary-husky 2acdbc6
Merge branch 'merge_new'
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,3 +98,4 @@ wandb/ | |
|
|
||
| # checkpoints | ||
| checkpoints/ | ||
| launcher_record | ||
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| logoru | ||
| beast_logger |
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||
| project: AgentScope-ReAct | ||||||
| name: GSM8K-Qwen3-8B | ||||||
| checkpoint_root_dir: ${oc.env:TRINITY_CHECKPOINT_ROOT_DIR,./checkpoints} | ||||||
| algorithm: | ||||||
| algorithm_type: multi_step_grpo | ||||||
| repeat_times: 8 | ||||||
| optimizer: | ||||||
| lr: 1e-6 | ||||||
| model: | ||||||
| model_path: '/mnt/data/model_cache/modelscope/hub/Qwen/Qwen/Qwen2___5-1___5B-Instruct' | ||||||
|
Collaborator
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.
Suggested change
|
||||||
| max_response_tokens: 16384 | ||||||
| max_model_len: 24576 | ||||||
| cluster: | ||||||
| node_num: 1 | ||||||
| gpu_per_node: 8 | ||||||
| buffer: | ||||||
| total_epochs: 1 | ||||||
| batch_size: 32 | ||||||
| train_batch_size: 256 | ||||||
| explorer_input: | ||||||
| taskset: | ||||||
| name: gsm8k | ||||||
| storage_type: env_service | ||||||
| path: 'http://localhost:8080' | ||||||
| subset_name: 'appworld' | ||||||
| split: 'train' | ||||||
| format: | ||||||
| prompt_key: 'question' | ||||||
| response_key: 'answer' | ||||||
| rollout_args: | ||||||
| temperature: 1.0 | ||||||
| default_workflow_type: 'agentopia_workflow' | ||||||
| eval_tasksets: [] | ||||||
| trainer_input: | ||||||
| experience_buffer: | ||||||
| name: agentscope_gsm8k_buffer | ||||||
| storage_type: queue | ||||||
| explorer: | ||||||
| eval_interval: 50 | ||||||
| runner_per_model: 16 | ||||||
| max_timeout: 1800 | ||||||
| rollout_model: | ||||||
| engine_num: 4 | ||||||
| tensor_parallel_size: 1 | ||||||
| enable_prefix_caching: false | ||||||
| enforce_eager: true | ||||||
| enable_openai_api: true | ||||||
| enable_history: true | ||||||
| enable_auto_tool_choice: true | ||||||
| tool_call_parser: hermes | ||||||
| # reasoning_parser: deepseek_r1 | ||||||
| enable_thinking: false | ||||||
| dtype: bfloat16 | ||||||
| seed: 42 | ||||||
| synchronizer: | ||||||
| sync_style: dynamic_by_explorer | ||||||
| sync_method: 'nccl' | ||||||
| sync_interval: 2 | ||||||
| sync_timeout: 1200 | ||||||
| trainer: | ||||||
| save_interval: 100 | ||||||
| grad_clip: 1.0 | ||||||
| use_dynamic_bsz: true | ||||||
| max_token_len_per_gpu: 24576 | ||||||
| ulysses_sequence_parallel_size: 2 | ||||||
| monitor: | ||||||
| monitor_type: tensorboard | ||||||
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 |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ algorithm: | |
| optimizer: | ||
| lr: 1e-5 | ||
| model: | ||
| model_path: ${oc.env:TRINITY_MODEL_PATH,Qwen/Qwen2.5-1.5B-Instruct} | ||
| model_path: '/mnt/data/model_cache/modelscope/hub/Qwen/Qwen/Qwen2___5-1___5B-Instruct' | ||
|
Collaborator
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. Unnecessary change. |
||
| max_response_tokens: 1024 | ||
| max_model_len: 2048 | ||
| cluster: | ||
|
|
@@ -50,6 +50,7 @@ explorer: | |
| engine_num: 2 | ||
| tensor_parallel_size: 1 | ||
| enable_prefix_caching: false | ||
| gpu_memory_utilization: 0.7 | ||
| enforce_eager: true | ||
| dtype: bfloat16 | ||
| seed: 42 | ||
|
|
||
Empty file.
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,12 @@ | ||
|
|
||
|
|
||
| /mnt/data_cpfs/qingxu.fu/trinity/trinity/explorer/workflow_runner.py | ||
| run_task() | ||
|
|
||
| --> | ||
| /mnt/data_cpfs/qingxu.fu/trinity/examples/agentscope_react/gsm8k.yaml | ||
| buffer.explorer_input.default_workflow_type | ||
| --> | ||
|
|
||
| /mnt/data_cpfs/qingxu.fu/trinity/trinity/common/workflows/agentscope/react/react_workflow.py | ||
| run_async() |
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,77 @@ | ||
| """ | ||
| Simple smoke test for SwanlabMonitor. | ||
|
|
||
| Run: | ||
| python cradle.py | ||
|
|
||
| What it does: | ||
| - Ensures SWANLAB_API_KEY is read from environment (sets a dummy if missing). | ||
| - Initializes SwanlabMonitor with minimal args. | ||
| - Logs a small metric and closes the run. | ||
|
|
||
| Notes: | ||
| - If `swanlab` is not installed, this script will print a helpful message and exit. | ||
| - The dummy API key is used only to exercise the login path; real authentication isn't required for this smoke test. | ||
| """ | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
|
|
||
| def main() -> int: | ||
| # Defer imports to keep error handling simple | ||
| try: | ||
| from trinity.utils.monitor import SwanlabMonitor | ||
| except Exception as e: | ||
| print("Failed to import SwanlabMonitor:", e) | ||
| return 1 | ||
|
|
||
| # Ensure an env-based key path is exercised (uses dummy if not provided) | ||
| env_keys = ["SWANLAB_API_KEY", "SWANLAB_APIKEY", "SWANLAB_KEY", "SWANLAB_TOKEN"] | ||
| if not any(os.getenv(k) for k in env_keys): | ||
| os.environ["SWANLAB_API_KEY"] = "dummy_key_for_smoke_test" | ||
| print("Set SWANLAB_API_KEY to a dummy value to test env-based login path.") | ||
|
|
||
| # Try creating the monitor; if swanlab isn't installed, __init__ will assert | ||
| try: | ||
| mon = SwanlabMonitor( | ||
| project="trinity-smoke", | ||
| group="cradle", | ||
| name="swanlab-env", | ||
| role="tester", | ||
| config=None, | ||
| ) | ||
| except AssertionError as e: | ||
| print("SwanLab not available or not installed:", e) | ||
| print("Install swanlab to run this smoke test: pip install swanlab") | ||
| return 0 | ||
| except Exception as e: | ||
| print("Unexpected error constructing SwanlabMonitor:", e) | ||
| return 1 | ||
|
|
||
| # Log a minimal metric to verify basic flow | ||
| try: | ||
| mon.log({"smoke/metric": 1.0}, step=1) | ||
| print("Logged a test metric via SwanlabMonitor.") | ||
| except Exception as e: | ||
| print("Error during logging:", e) | ||
| try: | ||
| mon.close() | ||
| except Exception: | ||
| pass | ||
| return 1 | ||
|
|
||
| # Close cleanly | ||
| try: | ||
| mon.close() | ||
| print("SwanlabMonitor closed successfully.") | ||
| except Exception as e: | ||
| print("Error closing monitor:", e) | ||
| return 1 | ||
|
|
||
| print("Smoke test completed.") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) |
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
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
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
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
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.
Unnecessary change.