File tree Expand file tree Collapse file tree 11 files changed +11
-11
lines changed
source_en/Usage Guide/Server and Client Expand file tree Collapse file tree 11 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1919# - base_url: the address of the running server
2020# - api_key: authentication token (loaded from environment variable)
2121service_client = init_tinker_compat_client (
22- base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ))
22+ base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_TOKEN ' ))
2323
2424# Step 3: List models available on the server to verify the connection
2525print ('Available models:' )
Original file line number Diff line number Diff line change 1414base_model = 'Qwen/Qwen3-30B-A3B-Instruct-2507'
1515service_client = init_tinker_compat_client (
1616 base_url = 'http://www.modelscope.cn/twinkle' ,
17- api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' )
17+ api_key = os .environ .get ('MODELSCOPE_TOKEN ' )
1818)
1919# Step 2: Create a sampling client by loading weights from a saved checkpoint.
2020# The model_path is a twinkle:// URI pointing to a previously saved LoRA checkpoint.
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def train():
4444
4545 # Connect to the Twinkle server running locally
4646 service_client = init_tinker_compat_client (
47- base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ))
47+ base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_TOKEN ' ))
4848
4949 # Create a LoRA training client for the base model (rank=16 for the LoRA adapter)
5050 training_client = service_client .create_lora_training_client (base_model = base_model , rank = 16 )
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ def main():
216216 # Step 2: Initialize the Tinker-compatible client
217217 logger .info ('Connecting to Tinker server...' )
218218 service_client = init_tinker_compat_client (
219- base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ))
219+ base_url = 'http://www.modelscope.cn/twinkle' , api_key = os .environ .get ('MODELSCOPE_TOKEN ' ))
220220
221221 logger .info ('Creating LoRA training client...' )
222222 # Create a LoRA training client for GRPO
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def train():
7575 # Step 1: Initialize the Twinkle client
7676 client = init_twinkle_client (
7777 base_url = 'http://127.0.0.1:8000' ,
78- api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ),
78+ api_key = os .environ .get ('MODELSCOPE_TOKEN ' ),
7979 )
8080
8181 # Step 2: Prepare dataset and dataloader
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def sample():
3636 # Step 2: Initialize the Twinkle client to communicate with the remote server.
3737 client = init_twinkle_client (
3838 base_url = 'http://127.0.0.1:8000' ,
39- api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ),
39+ api_key = os .environ .get ('MODELSCOPE_TOKEN ' ),
4040 )
4141
4242 # Step 3: Create the sampler client pointing to the model on the server
Original file line number Diff line number Diff line change 2626# Step 2: Initialize the Twinkle client to communicate with the remote server.
2727# - base_url: the address of the running Twinkle server
2828# - api_key: authentication token (loaded from environment variable)
29- client = init_twinkle_client (base_url = 'http://127.0.0.1:8000' , api_key = os .environ .get ('MODELSCOPE_SDK_TOKEN ' ))
29+ client = init_twinkle_client (base_url = 'http://127.0.0.1:8000' , api_key = os .environ .get ('MODELSCOPE_TOKEN ' ))
3030
3131# Step 3: Query the server for existing training runs and their checkpoints.
3232# This is useful for resuming a previous training session.
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ from twinkle_client import init_tinker_compat_client
4545# Step 1: Initialize client (automatically patches Tinker SDK)
4646service_client = init_tinker_compat_client(
4747 base_url = ' http://localhost:8000' ,
48- api_key = os.environ.get(' MODELSCOPE_SDK_TOKEN ' )
48+ api_key = os.environ.get(' MODELSCOPE_TOKEN ' )
4949)
5050
5151# Step 2: Query existing training runs (optional)
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ logger = get_logger()
7676# Step 1: Initialize client
7777client = init_twinkle_client(
7878 base_url = ' http://127.0.0.1:8000' ,
79- api_key = os.environ.get(' MODELSCOPE_SDK_TOKEN ' )
79+ api_key = os.environ.get(' MODELSCOPE_TOKEN ' )
8080)
8181
8282# Step 2: Query existing training runs (optional, for resuming training)
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ from twinkle_client import init_tinker_compat_client
4545# Step 1: 初始化客户端(会自动 patch Tinker SDK)
4646service_client = init_tinker_compat_client(
4747 base_url = ' http://localhost:8000' ,
48- api_key = os.environ.get(' MODELSCOPE_SDK_TOKEN ' )
48+ api_key = os.environ.get(' MODELSCOPE_TOKEN ' )
4949)
5050
5151# Step 2: 查询已有训练运行(可选)
You can’t perform that action at this time.
0 commit comments