-
Notifications
You must be signed in to change notification settings - Fork 22
update client server doc #43
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e03d087
add patch
Yunnglin a8fa9ef
update
Yunnglin 61fecc6
Merge branch 'dev' into add_rl_server
Yunnglin 9a1aa2e
add client code
Yunnglin 9053664
update cookbook
Yunnglin b591870
update cookbook
Yunnglin 4c996af
Merge branch 'dev' into add_rl_server
Yunnglin 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
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,21 @@ | ||
| # Twinkle Server Launcher - Tinker-Compatible Megatron Backend | ||
| # | ||
| # This script starts the Twinkle server with Tinker-compatible API support | ||
| # using the Megatron model backend. | ||
| # It reads the server_config.yaml in the same directory for all | ||
| # configuration (model, deployment settings, etc.). | ||
| # Run this script BEFORE running the client training script (lora.py). | ||
|
|
||
| import os | ||
|
|
||
| # Enable Ray debug mode for verbose logging during development | ||
| os.environ['RAY_DEBUG'] = '1' | ||
|
|
||
| from twinkle.server import launch_server | ||
|
|
||
| # Resolve the path to server_config.yaml relative to this script's location | ||
| file_dir = os.path.abspath(os.path.dirname(__file__)) | ||
| config_path = os.path.join(file_dir, 'server_config.yaml') | ||
|
|
||
| # Launch the Twinkle server — this call blocks until the server is shut down | ||
| launch_server(config_path=config_path) |
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,58 @@ | ||
| # Twinkle Server Configuration - Tinker-Compatible Megatron Backend | ||
|
|
||
| # Server protocol type: "tinker" enables the Tinker-compatible API | ||
| server_type: tinker | ||
|
|
||
| # proxy_location: determines where the HTTP proxy runs. | ||
| # "EveryNode" means each Ray node runs its own proxy (good for multi-node). | ||
| proxy_location: EveryNode | ||
|
|
||
| # HTTP listener settings | ||
| http_options: | ||
| host: 0.0.0.0 # Listen on all network interfaces | ||
| port: 8000 # Port number for the server | ||
|
|
||
| # Applications: each entry defines a service component deployed on the server | ||
| applications: | ||
|
|
||
| # 1. TinkerCompatServer - The central API server | ||
| # Handles client connections, training run tracking, checkpoint listing. | ||
| - name: server | ||
| route_prefix: /api/v1 # API endpoint prefix (Tinker-compatible) | ||
| import_path: server # Python module to import | ||
| args: | ||
|
|
||
| deployments: | ||
| - name: TinkerCompatServer | ||
| autoscaling_config: | ||
| min_replicas: 1 # Minimum number of replicas | ||
| max_replicas: 1 # Maximum number of replicas | ||
| target_ongoing_requests: 128 # Target concurrent requests per replica | ||
| ray_actor_options: | ||
| num_cpus: 0.1 # CPU resources allocated to this actor | ||
|
|
||
| # 2. Model Service - Hosts the base model for training (Megatron backend) | ||
| # This is the actual model worker that performs forward/backward passes. | ||
| - name: models-Qwen2.5-0.5B-Instruct | ||
| route_prefix: /api/v1/model/Qwen/Qwen2.5-0.5B-Instruct # REST path for this model | ||
| import_path: model | ||
| args: | ||
| use_megatron: true # Use Megatron-LM backend (not HuggingFace) | ||
| model_id: "ms://Qwen/Qwen2.5-0.5B-Instruct" # ModelScope model identifier to load | ||
| nproc_per_node: 2 # Number of GPU processes per node | ||
| device_group: # Logical device group for this model | ||
| name: model | ||
| ranks: [0, 1] # GPU rank indices to use | ||
| device_type: cuda | ||
| device_mesh: # Distributed training mesh configuration | ||
| device_type: cuda | ||
| mesh: [0, 1] # Device indices in the mesh | ||
| mesh_dim_names: ['dp'] # Mesh dimension names: 'dp' = data parallel | ||
| deployments: | ||
| - name: ModelManagement | ||
| autoscaling_config: | ||
| min_replicas: 1 | ||
| max_replicas: 1 | ||
| target_ongoing_requests: 16 | ||
| ray_actor_options: | ||
| num_cpus: 0.1 |
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.
The
sampler_codetemplate defined here generatesVLLMSampler.__init__with areturn response.json(). That makes the generated client invalid (constructors must returnNone) and will also fail when/createreturns a non-JSON/empty body. Please adjust the template to not return from__init__and to only parse JSON for endpoints that actually return JSON.