together 1.5.16__py3-none-any.whl → 1.5.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- together/cli/api/finetune.py +24 -8
- together/resources/chat/completions.py +1 -1
- together/resources/finetune.py +34 -0
- together/types/chat_completions.py +8 -1
- together/types/finetune.py +3 -0
- {together-1.5.16.dist-info → together-1.5.18.dist-info}/METADATA +1 -1
- {together-1.5.16.dist-info → together-1.5.18.dist-info}/RECORD +10 -10
- {together-1.5.16.dist-info → together-1.5.18.dist-info}/LICENSE +0 -0
- {together-1.5.16.dist-info → together-1.5.18.dist-info}/WHEEL +0 -0
- {together-1.5.16.dist-info → together-1.5.18.dist-info}/entry_points.txt +0 -0
together/cli/api/finetune.py
CHANGED
|
@@ -139,7 +139,7 @@ def fine_tuning(ctx: click.Context) -> None:
|
|
|
139
139
|
@click.option(
|
|
140
140
|
"--dpo-beta",
|
|
141
141
|
type=float,
|
|
142
|
-
default=
|
|
142
|
+
default=None,
|
|
143
143
|
help="Beta parameter for DPO training (only used when '--training-method' is 'dpo')",
|
|
144
144
|
)
|
|
145
145
|
@click.option(
|
|
@@ -154,7 +154,7 @@ def fine_tuning(ctx: click.Context) -> None:
|
|
|
154
154
|
@click.option(
|
|
155
155
|
"--rpo-alpha",
|
|
156
156
|
type=float,
|
|
157
|
-
default=
|
|
157
|
+
default=None,
|
|
158
158
|
help=(
|
|
159
159
|
"RPO alpha parameter of DPO training to include NLL in the loss "
|
|
160
160
|
"(only used when '--training-method' is 'dpo')"
|
|
@@ -163,7 +163,7 @@ def fine_tuning(ctx: click.Context) -> None:
|
|
|
163
163
|
@click.option(
|
|
164
164
|
"--simpo-gamma",
|
|
165
165
|
type=float,
|
|
166
|
-
default=
|
|
166
|
+
default=None,
|
|
167
167
|
help="SimPO gamma parameter (only used when '--training-method' is 'dpo')",
|
|
168
168
|
)
|
|
169
169
|
@click.option(
|
|
@@ -188,7 +188,7 @@ def fine_tuning(ctx: click.Context) -> None:
|
|
|
188
188
|
@click.option(
|
|
189
189
|
"--train-on-inputs",
|
|
190
190
|
type=BOOL_WITH_AUTO,
|
|
191
|
-
default=
|
|
191
|
+
default=None,
|
|
192
192
|
help="Whether to mask the user messages in conversational data or prompts in instruction data. "
|
|
193
193
|
"`auto` will automatically determine whether to mask the inputs based on the data format.",
|
|
194
194
|
)
|
|
@@ -200,6 +200,18 @@ def fine_tuning(ctx: click.Context) -> None:
|
|
|
200
200
|
"The format: {$JOB_ID/$OUTPUT_MODEL_NAME}:{$STEP}. "
|
|
201
201
|
"The step value is optional, without it the final checkpoint will be used.",
|
|
202
202
|
)
|
|
203
|
+
@click.option(
|
|
204
|
+
"--hf-api-token",
|
|
205
|
+
type=str,
|
|
206
|
+
default=None,
|
|
207
|
+
help="HF API token to use for uploading a checkpoint to a private repo",
|
|
208
|
+
)
|
|
209
|
+
@click.option(
|
|
210
|
+
"--hf-output-repo-name",
|
|
211
|
+
type=str,
|
|
212
|
+
default=None,
|
|
213
|
+
help="HF repo to upload the fine-tuned model to",
|
|
214
|
+
)
|
|
203
215
|
def create(
|
|
204
216
|
ctx: click.Context,
|
|
205
217
|
training_file: str,
|
|
@@ -229,11 +241,13 @@ def create(
|
|
|
229
241
|
confirm: bool,
|
|
230
242
|
train_on_inputs: bool | Literal["auto"],
|
|
231
243
|
training_method: str,
|
|
232
|
-
dpo_beta: float,
|
|
244
|
+
dpo_beta: float | None,
|
|
233
245
|
dpo_normalize_logratios_by_length: bool,
|
|
234
|
-
rpo_alpha: float,
|
|
235
|
-
simpo_gamma: float,
|
|
246
|
+
rpo_alpha: float | None,
|
|
247
|
+
simpo_gamma: float | None,
|
|
236
248
|
from_checkpoint: str,
|
|
249
|
+
hf_api_token: str | None,
|
|
250
|
+
hf_output_repo_name: str | None,
|
|
237
251
|
) -> None:
|
|
238
252
|
"""Start fine-tuning"""
|
|
239
253
|
client: Together = ctx.obj
|
|
@@ -270,6 +284,8 @@ def create(
|
|
|
270
284
|
rpo_alpha=rpo_alpha,
|
|
271
285
|
simpo_gamma=simpo_gamma,
|
|
272
286
|
from_checkpoint=from_checkpoint,
|
|
287
|
+
hf_api_token=hf_api_token,
|
|
288
|
+
hf_output_repo_name=hf_output_repo_name,
|
|
273
289
|
)
|
|
274
290
|
|
|
275
291
|
if model is None and from_checkpoint is None:
|
|
@@ -280,7 +296,7 @@ def create(
|
|
|
280
296
|
model_name = from_checkpoint.split(":")[0]
|
|
281
297
|
|
|
282
298
|
model_limits: FinetuneTrainingLimits = client.fine_tuning.get_model_limits(
|
|
283
|
-
model=model_name
|
|
299
|
+
model=model_name,
|
|
284
300
|
)
|
|
285
301
|
|
|
286
302
|
if lora:
|
|
@@ -38,7 +38,7 @@ class ChatCompletions:
|
|
|
38
38
|
echo: bool | None = None,
|
|
39
39
|
n: int | None = None,
|
|
40
40
|
safety_model: str | None = None,
|
|
41
|
-
response_format: Dict[str,
|
|
41
|
+
response_format: Dict[str, Any] | None = None,
|
|
42
42
|
tools: List[Dict[str, Any]] | None = None,
|
|
43
43
|
tool_choice: str | Dict[str, str | Dict[str, str]] | None = None,
|
|
44
44
|
**kwargs: Any,
|
together/resources/finetune.py
CHANGED
|
@@ -76,6 +76,8 @@ def create_finetune_request(
|
|
|
76
76
|
rpo_alpha: float | None = None,
|
|
77
77
|
simpo_gamma: float | None = None,
|
|
78
78
|
from_checkpoint: str | None = None,
|
|
79
|
+
hf_api_token: str | None = None,
|
|
80
|
+
hf_output_repo_name: str | None = None,
|
|
79
81
|
) -> FinetuneRequest:
|
|
80
82
|
if model is not None and from_checkpoint is not None:
|
|
81
83
|
raise ValueError(
|
|
@@ -183,6 +185,24 @@ def create_finetune_request(
|
|
|
183
185
|
)
|
|
184
186
|
train_on_inputs = "auto"
|
|
185
187
|
|
|
188
|
+
if dpo_beta is not None and training_method != "dpo":
|
|
189
|
+
raise ValueError("dpo_beta is only supported for DPO training")
|
|
190
|
+
if dpo_normalize_logratios_by_length and training_method != "dpo":
|
|
191
|
+
raise ValueError(
|
|
192
|
+
"dpo_normalize_logratios_by_length=True is only supported for DPO training"
|
|
193
|
+
)
|
|
194
|
+
if rpo_alpha is not None:
|
|
195
|
+
if training_method != "dpo":
|
|
196
|
+
raise ValueError("rpo_alpha is only supported for DPO training")
|
|
197
|
+
if not rpo_alpha >= 0.0:
|
|
198
|
+
raise ValueError(f"rpo_alpha should be non-negative (got {rpo_alpha})")
|
|
199
|
+
|
|
200
|
+
if simpo_gamma is not None:
|
|
201
|
+
if training_method != "dpo":
|
|
202
|
+
raise ValueError("simpo_gamma is only supported for DPO training")
|
|
203
|
+
if not simpo_gamma >= 0.0:
|
|
204
|
+
raise ValueError(f"simpo_gamma should be non-negative (got {simpo_gamma})")
|
|
205
|
+
|
|
186
206
|
lr_scheduler: FinetuneLRScheduler
|
|
187
207
|
if lr_scheduler_type == "cosine":
|
|
188
208
|
if scheduler_num_cycles <= 0.0:
|
|
@@ -244,6 +264,8 @@ def create_finetune_request(
|
|
|
244
264
|
wandb_name=wandb_name,
|
|
245
265
|
training_method=training_method_cls,
|
|
246
266
|
from_checkpoint=from_checkpoint,
|
|
267
|
+
hf_api_token=hf_api_token,
|
|
268
|
+
hf_output_repo_name=hf_output_repo_name,
|
|
247
269
|
)
|
|
248
270
|
|
|
249
271
|
return finetune_request
|
|
@@ -323,6 +345,8 @@ class FineTuning:
|
|
|
323
345
|
rpo_alpha: float | None = None,
|
|
324
346
|
simpo_gamma: float | None = None,
|
|
325
347
|
from_checkpoint: str | None = None,
|
|
348
|
+
hf_api_token: str | None = None,
|
|
349
|
+
hf_output_repo_name: str | None = None,
|
|
326
350
|
) -> FinetuneResponse:
|
|
327
351
|
"""
|
|
328
352
|
Method to initiate a fine-tuning job
|
|
@@ -379,6 +403,8 @@ class FineTuning:
|
|
|
379
403
|
from_checkpoint (str, optional): The checkpoint identifier to continue training from a previous fine-tuning job.
|
|
380
404
|
The format: {$JOB_ID/$OUTPUT_MODEL_NAME}:{$STEP}.
|
|
381
405
|
The step value is optional, without it the final checkpoint will be used.
|
|
406
|
+
hf_api_token (str, optional): API key for the Hugging Face Hub. Defaults to None.
|
|
407
|
+
hf_output_repo_name (str, optional): HF repo to upload the fine-tuned model to. Defaults to None.
|
|
382
408
|
|
|
383
409
|
Returns:
|
|
384
410
|
FinetuneResponse: Object containing information about fine-tuning job.
|
|
@@ -432,6 +458,8 @@ class FineTuning:
|
|
|
432
458
|
rpo_alpha=rpo_alpha,
|
|
433
459
|
simpo_gamma=simpo_gamma,
|
|
434
460
|
from_checkpoint=from_checkpoint,
|
|
461
|
+
hf_api_token=hf_api_token,
|
|
462
|
+
hf_output_repo_name=hf_output_repo_name,
|
|
435
463
|
)
|
|
436
464
|
|
|
437
465
|
if verbose:
|
|
@@ -744,6 +772,8 @@ class AsyncFineTuning:
|
|
|
744
772
|
rpo_alpha: float | None = None,
|
|
745
773
|
simpo_gamma: float | None = None,
|
|
746
774
|
from_checkpoint: str | None = None,
|
|
775
|
+
hf_api_token: str | None = None,
|
|
776
|
+
hf_output_repo_name: str | None = None,
|
|
747
777
|
) -> FinetuneResponse:
|
|
748
778
|
"""
|
|
749
779
|
Async method to initiate a fine-tuning job
|
|
@@ -800,6 +830,8 @@ class AsyncFineTuning:
|
|
|
800
830
|
from_checkpoint (str, optional): The checkpoint identifier to continue training from a previous fine-tuning job.
|
|
801
831
|
The format: {$JOB_ID/$OUTPUT_MODEL_NAME}:{$STEP}.
|
|
802
832
|
The step value is optional, without it the final checkpoint will be used.
|
|
833
|
+
hf_api_token (str, optional): API key for the Huggging Face Hub. Defaults to None.
|
|
834
|
+
hf_output_repo_name (str, optional): HF repo to upload the fine-tuned model to. Defaults to None.
|
|
803
835
|
|
|
804
836
|
Returns:
|
|
805
837
|
FinetuneResponse: Object containing information about fine-tuning job.
|
|
@@ -853,6 +885,8 @@ class AsyncFineTuning:
|
|
|
853
885
|
rpo_alpha=rpo_alpha,
|
|
854
886
|
simpo_gamma=simpo_gamma,
|
|
855
887
|
from_checkpoint=from_checkpoint,
|
|
888
|
+
hf_api_token=hf_api_token,
|
|
889
|
+
hf_output_repo_name=hf_output_repo_name,
|
|
856
890
|
)
|
|
857
891
|
|
|
858
892
|
if verbose:
|
|
@@ -28,6 +28,7 @@ class MessageRole(str, Enum):
|
|
|
28
28
|
class ResponseFormatType(str, Enum):
|
|
29
29
|
JSON_OBJECT = "json_object"
|
|
30
30
|
JSON_SCHEMA = "json_schema"
|
|
31
|
+
REGEX = "regex"
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
class FunctionCall(BaseModel):
|
|
@@ -71,9 +72,15 @@ class ChatCompletionMessage(BaseModel):
|
|
|
71
72
|
class ResponseFormat(BaseModel):
|
|
72
73
|
type: ResponseFormatType
|
|
73
74
|
schema_: Dict[str, Any] | None = None
|
|
75
|
+
pattern: str | None = None
|
|
74
76
|
|
|
75
77
|
def to_dict(self) -> Dict[str, Any]:
|
|
76
|
-
|
|
78
|
+
result: Dict[str, Any] = {"type": self.type.value}
|
|
79
|
+
if self.schema_ is not None:
|
|
80
|
+
result["schema"] = self.schema_
|
|
81
|
+
if self.pattern is not None:
|
|
82
|
+
result["pattern"] = self.pattern
|
|
83
|
+
return result
|
|
77
84
|
|
|
78
85
|
|
|
79
86
|
class FunctionTool(BaseModel):
|
together/types/finetune.py
CHANGED
|
@@ -7,7 +7,7 @@ together/cli/api/chat.py,sha256=2PHRb-9T-lUEKhUJFtc7SxJv3shCVx40gq_8pzfsewM,9234
|
|
|
7
7
|
together/cli/api/completions.py,sha256=l-Zw5t7hojL3w8xd_mitS2NRB72i5Z0xwkzH0rT5XMc,4263
|
|
8
8
|
together/cli/api/endpoints.py,sha256=f6KafWZvRF6n_ThWdr3y9uhE6wPF37PcD45w_EtgXmY,13289
|
|
9
9
|
together/cli/api/files.py,sha256=QLYEXRkY8J2Gg1SbTCtzGfoTMvosoeACNK83L_oLubs,3397
|
|
10
|
-
together/cli/api/finetune.py,sha256=
|
|
10
|
+
together/cli/api/finetune.py,sha256=vIAvHQ8K6AxqJn2aqxd2ZPb1ZicLeb509_LpD4A9Thw,17517
|
|
11
11
|
together/cli/api/images.py,sha256=GADSeaNUHUVMtWovmccGuKc28IJ9E_v4vAEwYHJhu5o,2645
|
|
12
12
|
together/cli/api/models.py,sha256=CXw8B1hqNkadogi58GIXhLg_dTJnvTBaE7Kq1_xQ-10,1423
|
|
13
13
|
together/cli/api/utils.py,sha256=IuqYWPnLI38_Bqd7lj8V_SnGdYc59pRmMbQmciS4FsM,1326
|
|
@@ -29,13 +29,13 @@ together/resources/audio/__init__.py,sha256=e7xp0Lkp_nMAHXcuFHS7dLXP_YqTPMMZIilW
|
|
|
29
29
|
together/resources/audio/speech.py,sha256=81ib_gIo-Rxoaipx2Pi9ZsKnOTjeFPwSlBrcUkyX5xk,5211
|
|
30
30
|
together/resources/batch.py,sha256=wSJR30CAFjzZ436vjYdXLCT0ahA5E0ud_qHMS5YvZ1M,3750
|
|
31
31
|
together/resources/chat/__init__.py,sha256=RsTptdP8MeGjcdIjze896-J27cRvCbUoMft0X2BVlQ8,617
|
|
32
|
-
together/resources/chat/completions.py,sha256=
|
|
32
|
+
together/resources/chat/completions.py,sha256=cBsSFWi9qToQCn4V_3qJ0gwRqORjF6NFDXmHcHfIhOY,14442
|
|
33
33
|
together/resources/code_interpreter.py,sha256=vbN8Mh5MG6HQvqra7p61leIyfebgbgJTM_q2A_Fylhw,2948
|
|
34
34
|
together/resources/completions.py,sha256=5Wa-ZjPCxRcam6CDe7KgGYlTA7yJZMmd5TrRgGCL_ug,11726
|
|
35
35
|
together/resources/embeddings.py,sha256=PTvLb82yjG_-iQOyuhsilp77Fr7gZ0o6WD2KeRnKoxs,2675
|
|
36
36
|
together/resources/endpoints.py,sha256=NNjp-wyzOotzlscGGrANhOHxQBjHTN8f5kTQTH_CLvE,17177
|
|
37
37
|
together/resources/files.py,sha256=y3Ri6UtyAa7fjCJ8_fp26Y2hzzi6Aoo21JKkVgljFl8,5026
|
|
38
|
-
together/resources/finetune.py,sha256=
|
|
38
|
+
together/resources/finetune.py,sha256=IFevk_AwCr9D2f4LssKEFP9OEDbHSuFA5CZMusDHajc,41343
|
|
39
39
|
together/resources/images.py,sha256=LQUjKPaFxWTqOAPnyF1Pp7Rz4NLOYhmoKwshpYiprEM,4923
|
|
40
40
|
together/resources/models.py,sha256=qgmAXv61Cq4oLxytenEZBywA8shldDHYxJ_EAu_4JWQ,3864
|
|
41
41
|
together/resources/rerank.py,sha256=3Ju_aRSyZ1s_3zCSNZnSnEJErUVmt2xa3M8z1nvejMA,3931
|
|
@@ -44,7 +44,7 @@ together/types/__init__.py,sha256=_93XstLg1OOWratj_N1bsNN-2aS628uHH3SZj0wszyc,28
|
|
|
44
44
|
together/types/abstract.py,sha256=1lFQI_3WjsR_t1128AeKW0aTk6EiM6Gh1J3ZuyLLPao,642
|
|
45
45
|
together/types/audio_speech.py,sha256=jlj8BZf3dkIDARF1P11fuenVLj4try8Yx4RN-EAkhOU,2609
|
|
46
46
|
together/types/batch.py,sha256=FP0RuQ3EDy-FV1bh-biPICvyRS7WqLm38GHz5lzKyXM,1112
|
|
47
|
-
together/types/chat_completions.py,sha256=
|
|
47
|
+
together/types/chat_completions.py,sha256=NxJ7tFlWynxoLsRtQHzM7Ka3QxKVjRs6EvtOTYZ79bM,5340
|
|
48
48
|
together/types/code_interpreter.py,sha256=cjF8TKgRkJllHS4i24dWQZBGTRsG557eHSewOiip0Kk,1770
|
|
49
49
|
together/types/common.py,sha256=kxZ-N9xtBsGYZBmbIWnZ0rfT3Pn8PFB7sAbp3iv96pw,1525
|
|
50
50
|
together/types/completions.py,sha256=o3FR5ixsTUj-a3pmOUzbSQg-hESVhpqrC9UD__VCqr4,2971
|
|
@@ -52,7 +52,7 @@ together/types/embeddings.py,sha256=J7grkYYn7xhqeKaBO2T-8XQRtHhkzYzymovtGdIUK5A,
|
|
|
52
52
|
together/types/endpoints.py,sha256=EzNhHOoQ_D9fUdNQtxQPeSWiFzdFLqpNodN0YLmv_h0,4393
|
|
53
53
|
together/types/error.py,sha256=OVlCs3cx_2WhZK4JzHT8SQyRIIqKOP1AZQ4y1PydjAE,370
|
|
54
54
|
together/types/files.py,sha256=i-Ke57p8Svb1MbMZxu-Fo2zxIc6j-mDO2TLGNwPpGu0,1981
|
|
55
|
-
together/types/finetune.py,sha256=
|
|
55
|
+
together/types/finetune.py,sha256=MRSgM7-s4p_5ZO72UaE78wtEVaTRA7yc53wZuDTty18,11182
|
|
56
56
|
together/types/images.py,sha256=xnC-FZGdZU30WSFTybfGneWxb-kj0ZGufJsgHtB8j0k,980
|
|
57
57
|
together/types/models.py,sha256=nwQIZGHKZpX9I6mK8z56VW70YC6Ry6JGsVa0s99QVxc,1055
|
|
58
58
|
together/types/rerank.py,sha256=qZfuXOn7MZ6ly8hpJ_MZ7OU_Bi1-cgYNSB20Wja8Qkk,1061
|
|
@@ -62,8 +62,8 @@ together/utils/api_helpers.py,sha256=2K0O6qeEQ2zVFvi5NBN5m2kjZJaS3-JfKFecQ7SmGaw
|
|
|
62
62
|
together/utils/files.py,sha256=btWQawwXbNKfPmCtRyObZViG1Xx-IPz45PrAtMXvcy8,16741
|
|
63
63
|
together/utils/tools.py,sha256=H2MTJhEqtBllaDvOyZehIO_IVNK3P17rSDeILtJIVag,2964
|
|
64
64
|
together/version.py,sha256=p03ivHyE0SyWU4jAnRTBi_sOwywVWoZPU4g2gzRgG-Y,126
|
|
65
|
-
together-1.5.
|
|
66
|
-
together-1.5.
|
|
67
|
-
together-1.5.
|
|
68
|
-
together-1.5.
|
|
69
|
-
together-1.5.
|
|
65
|
+
together-1.5.18.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
66
|
+
together-1.5.18.dist-info/METADATA,sha256=lr8RNJjGXy_p8hK86PuQolCMt0nKtxGYD4HGrbDe1Ak,15497
|
|
67
|
+
together-1.5.18.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
68
|
+
together-1.5.18.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
|
|
69
|
+
together-1.5.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|