@@ -67,9 +67,11 @@ pip install -e .
6767| twinkle 客户端微调 | megatron | [ 脚本] ( cookbook/client/twinkle/megatron ) |
6868| twinkle 客户端微调 | transformer | [ 脚本] ( cookbook/client/twinkle/transformer ) |
6969
70+ Twinkle✨支持相同的算法接口运行在单GPU、torchrun多机、Ray、Client等各场景下。其算法过程是外露的,非常便于修改和调试。完整的框架介绍请查看[ 快速开始] ( docs/source_zh/使用指引/快速开始.md )
71+
7072## 更新日志
7173
72- - 🎉2026-02-13 Twinkle✨ 初始版本发布,包括对文本模型的 SFT /PT/RL 支持以及在 [ ModelScope ] ( https://modelscope.cn ) 上的无服务器训练能力 。
74+ 🎉2026-02-13 Twinkle✨ 初始版本发布,支持文本模型的SFT /PT/RL训练。我们还通过兼容Tinker的API,在魔搭社区上提供了无服务器训练功能 。
7375
7476## ModelScope 的训练服务
7577
@@ -88,8 +90,8 @@ pip install -e .
8890
8991随着新模型的发布,我们将添加对更多模型的支持。下表列出了 Twinkle✨ 框架当前支持的模型。
9092
91- > [ !注意 ]
92- > 对于通过 ` base_url=https://www.modelscope.cn/twinkle ` 访问的无服务器训练服务,目前一次只支持一个训练基座,当前是 [ Qwen3-30B-A3B-Instruct-2507] ( https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Instruct-2507 ) 。
93+ > [ !Note ]
94+ > 通过 ` base_url=https://www.modelscope.cn/twinkle ` 访问的无服务器训练服务,目前是通过兼容Tinker的API提供的。我们将陆续推出同时支持Tinker API和完整Twinkle✨原生 API的服务。无服务器端点每次由一个训练基座支持,目前使用的是 [ Qwen3-30B-A3B-Instruct-2507] ( https://modelscope.cn/models/Qwen/Qwen3-30B-A3B-Instruct-2507 ) 。
9395
9496| Model Type | Model ID 举例 | Model Size | Requires | Support Megatron | HF Model ID |
9597| ------------------- | ------------------------------------------------------------ | :-------------------------------------: | -------------------- | :--------------: | :----------------------------------------------------------: |
@@ -116,6 +118,8 @@ pip install -e .
116118
117119## 示例代码
118120
121+ 下面列出了示例代码的一部分能力。完整的训练能力介绍请参考[ 快速开始] ( docs/source_zh/使用指引/快速开始.md ) 以及[ cookbook] ( cookbook ) 。
122+
119123### 使用 Ray 训练
120124
121125``` python
@@ -135,7 +139,7 @@ twinkle.initialize(mode='ray', groups=device_group, global_device_mesh=device_me
135139
136140def train ():
137141 # to load model from Hugging Face, use 'hf://...'
138- base_model = ' ms://Qwen/Qwen2.5-7B-Instruct '
142+ base_model = ' ms://Qwen/Qwen3-4B '
139143 # 1000 samples
140144 dataset = Dataset(dataset_meta = DatasetMeta(' ms://swift/self-cognition' , data_slice = range (1000 )))
141145 # Set template to prepare encoding
@@ -179,26 +183,26 @@ if __name__ == '__main__':
179183 train()
180184```
181185
182- ### 使用类 Tinker API
186+ ### 使用类 Tinker API实现无服务器式训练
183187
184188``` python
185189import os
186190from tqdm import tqdm
187191from tinker import types
188- from twinkle_client import init_tinker_client
192+ from twinkle import init_tinker_client
189193from twinkle.dataloader import DataLoader
190194from twinkle.dataset import Dataset, DatasetMeta
191195from twinkle.preprocessor import SelfCognitionProcessor
192196from twinkle.server.tinker.common import input_feature_to_datum
193197
194198base_model = ' ms://Qwen/Qwen3-30B-A3B-Instruct-2507'
195- base_url= ' http://www.modelscope.cn/twinkle '
196- api_key= os.environ.get( ' MODELSCOPE_TOKEN ' )
199+ base_url= ' your-base-url '
200+ api_key= ' your-api-key '
197201
198202# Use twinkle dataset to load the data
199203dataset = Dataset(dataset_meta = DatasetMeta(' ms://swift/self-cognition' , data_slice = range (500 )))
200204dataset.set_template(' Template' , model_id = base_model, max_length = 256 )
201- dataset.map(SelfCognitionProcessor(' twinkle Model' , ' twinkle Team' ), load_from_cache_file = False )
205+ dataset.map(SelfCognitionProcessor(' twinkle Model' , ' ModelScope Team' ), load_from_cache_file = False )
202206dataset.encode(batched = True , load_from_cache_file = False )
203207dataloader = DataLoader(dataset = dataset, batch_size = 8 )
204208
0 commit comments