together 1.5.8__py3-none-any.whl → 1.5.13__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.
@@ -82,7 +82,7 @@ def endpoints(ctx: click.Context) -> None:
82
82
  @click.option(
83
83
  "--model",
84
84
  required=True,
85
- help="The model to deploy (e.g. mistralai/Mixtral-8x7B-Instruct-v0.1)",
85
+ help="The model to deploy (e.g. meta-llama/Llama-4-Scout-17B-16E-Instruct)",
86
86
  )
87
87
  @click.option(
88
88
  "--min-replicas",
@@ -1,10 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
+ import re
4
5
  from datetime import datetime, timezone
5
6
  from textwrap import wrap
6
7
  from typing import Any, Literal
7
- import re
8
8
 
9
9
  import click
10
10
  from click.core import ParameterSource # type: ignore[attr-defined]
@@ -13,17 +13,17 @@ from tabulate import tabulate
13
13
 
14
14
  from together import Together
15
15
  from together.cli.api.utils import BOOL_WITH_AUTO, INT_WITH_MAX
16
+ from together.types.finetune import (
17
+ DownloadCheckpointType,
18
+ FinetuneEventType,
19
+ FinetuneTrainingLimits,
20
+ )
16
21
  from together.utils import (
17
22
  finetune_price_to_dollars,
23
+ format_timestamp,
18
24
  log_warn,
19
25
  log_warn_once,
20
26
  parse_timestamp,
21
- format_timestamp,
22
- )
23
- from together.types.finetune import (
24
- DownloadCheckpointType,
25
- FinetuneTrainingLimits,
26
- FinetuneEventType,
27
27
  )
28
28
 
29
29
 
@@ -82,7 +82,7 @@ def fine_tuning(ctx: click.Context) -> None:
82
82
  @click.option(
83
83
  "--lr-scheduler-type",
84
84
  type=click.Choice(["linear", "cosine"]),
85
- default="linear",
85
+ default="cosine",
86
86
  help="Learning rate scheduler type",
87
87
  )
88
88
  @click.option(
@@ -348,9 +348,9 @@ def list(ctx: click.Context) -> None:
348
348
  "Model Output Name": "\n".join(wrap(i.output_name or "", width=30)),
349
349
  "Status": i.status,
350
350
  "Created At": i.created_at,
351
- "Price": f"""${finetune_price_to_dollars(
352
- float(str(i.total_price))
353
- )}""", # convert to string for mypy typing
351
+ "Price": f"""${
352
+ finetune_price_to_dollars(float(str(i.total_price)))
353
+ }""", # convert to string for mypy typing
354
354
  }
355
355
  )
356
356
  table = tabulate(display_list, headers="keys", tablefmt="grid", showindex=True)
together/client.py CHANGED
@@ -23,6 +23,7 @@ class Together:
23
23
  fine_tuning: resources.FineTuning
24
24
  rerank: resources.Rerank
25
25
  audio: resources.Audio
26
+ batches: resources.Batches
26
27
  code_interpreter: CodeInterpreter
27
28
 
28
29
  # client options
@@ -90,6 +91,7 @@ class Together:
90
91
  self.audio = resources.Audio(self.client)
91
92
  self.endpoints = resources.Endpoints(self.client)
92
93
  self.code_interpreter = CodeInterpreter(self.client)
94
+ self.batches = resources.Batches(self.client)
93
95
 
94
96
 
95
97
  class AsyncTogether:
@@ -102,7 +104,7 @@ class AsyncTogether:
102
104
  fine_tuning: resources.AsyncFineTuning
103
105
  rerank: resources.AsyncRerank
104
106
  code_interpreter: CodeInterpreter
105
-
107
+ batches: resources.AsyncBatches
106
108
  # client options
107
109
  client: TogetherClient
108
110
 
@@ -166,6 +168,7 @@ class AsyncTogether:
166
168
  self.fine_tuning = resources.AsyncFineTuning(self.client)
167
169
  self.rerank = resources.AsyncRerank(self.client)
168
170
  self.code_interpreter = CodeInterpreter(self.client)
171
+ self.batches = resources.AsyncBatches(self.client)
169
172
 
170
173
 
171
174
  Client = Together
@@ -8,6 +8,7 @@ from together.resources.finetune import AsyncFineTuning, FineTuning
8
8
  from together.resources.images import AsyncImages, Images
9
9
  from together.resources.models import AsyncModels, Models
10
10
  from together.resources.rerank import AsyncRerank, Rerank
11
+ from together.resources.batch import Batches, AsyncBatches
11
12
 
12
13
 
13
14
  __all__ = [
@@ -31,4 +32,6 @@ __all__ = [
31
32
  "Audio",
32
33
  "AsyncEndpoints",
33
34
  "Endpoints",
35
+ "Batches",
36
+ "AsyncBatches",
34
37
  ]
@@ -0,0 +1,136 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import List
4
+
5
+ from together.abstract import api_requestor
6
+ from together.together_response import TogetherResponse
7
+ from together.types import (
8
+ TogetherClient,
9
+ TogetherRequest,
10
+ BatchJob,
11
+ )
12
+
13
+
14
+ class Batches:
15
+ def __init__(self, client: TogetherClient) -> None:
16
+ self._client = client
17
+
18
+ def create_batch(self, file_id: str, endpoint: str) -> BatchJob:
19
+
20
+ requestor = api_requestor.APIRequestor(
21
+ client=self._client,
22
+ )
23
+
24
+ parameter_payload = {
25
+ "input_file_id": file_id,
26
+ "endpoint": endpoint,
27
+ "completion_window": "24h",
28
+ }
29
+
30
+ response, _, _ = requestor.request(
31
+ options=TogetherRequest(
32
+ method="POST",
33
+ url=f"batches",
34
+ params=parameter_payload,
35
+ ),
36
+ stream=False,
37
+ )
38
+
39
+ assert isinstance(response, TogetherResponse)
40
+ response_body = response.data.get("job", {})
41
+ return BatchJob(**response_body)
42
+
43
+ def get_batch(self, batch_job_id: str) -> BatchJob:
44
+ requestor = api_requestor.APIRequestor(
45
+ client=self._client,
46
+ )
47
+
48
+ response, _, _ = requestor.request(
49
+ options=TogetherRequest(
50
+ method="GET",
51
+ url=f"batches/{batch_job_id}",
52
+ ),
53
+ stream=False,
54
+ )
55
+
56
+ assert isinstance(response, TogetherResponse)
57
+ return BatchJob(**response.data)
58
+
59
+ def list_batches(self) -> List[BatchJob]:
60
+ requestor = api_requestor.APIRequestor(
61
+ client=self._client,
62
+ )
63
+
64
+ response, _, _ = requestor.request(
65
+ options=TogetherRequest(
66
+ method="GET",
67
+ url="batches",
68
+ ),
69
+ stream=False,
70
+ )
71
+
72
+ assert isinstance(response, TogetherResponse)
73
+ jobs = response.data or []
74
+ return [BatchJob(**job) for job in jobs]
75
+
76
+
77
+ class AsyncBatches:
78
+ def __init__(self, client: TogetherClient) -> None:
79
+ self._client = client
80
+
81
+ async def create_batch(self, file_id: str, endpoint: str) -> BatchJob:
82
+ requestor = api_requestor.APIRequestor(
83
+ client=self._client,
84
+ )
85
+
86
+ parameter_payload = {
87
+ "input_file_id": file_id,
88
+ "endpoint": endpoint,
89
+ "completion_window": "24h",
90
+ }
91
+
92
+ response, _, _ = await requestor.arequest(
93
+ options=TogetherRequest(
94
+ method="POST",
95
+ url=f"batches",
96
+ params=parameter_payload,
97
+ ),
98
+ stream=False,
99
+ )
100
+
101
+ assert isinstance(response, TogetherResponse)
102
+ response_body = response.data.get("job", {})
103
+ return BatchJob(**response_body)
104
+
105
+ async def get_batch(self, batch_job_id: str) -> BatchJob:
106
+ requestor = api_requestor.APIRequestor(
107
+ client=self._client,
108
+ )
109
+
110
+ response, _, _ = await requestor.arequest(
111
+ options=TogetherRequest(
112
+ method="GET",
113
+ url=f"batches/{batch_job_id}",
114
+ ),
115
+ stream=False,
116
+ )
117
+
118
+ assert isinstance(response, TogetherResponse)
119
+ return BatchJob(**response.data)
120
+
121
+ async def list_batches(self) -> List[BatchJob]:
122
+ requestor = api_requestor.APIRequestor(
123
+ client=self._client,
124
+ )
125
+
126
+ response, _, _ = await requestor.arequest(
127
+ options=TogetherRequest(
128
+ method="GET",
129
+ url="batches",
130
+ ),
131
+ stream=False,
132
+ )
133
+
134
+ assert isinstance(response, TogetherResponse)
135
+ jobs = response.data or []
136
+ return [BatchJob(**job) for job in jobs]
@@ -32,7 +32,7 @@ class Files:
32
32
  ) -> FileResponse:
33
33
  upload_manager = UploadManager(self._client)
34
34
 
35
- if check:
35
+ if check and purpose == FilePurpose.FineTune:
36
36
  report_dict = check_file(file)
37
37
  if not report_dict["is_check_passed"]:
38
38
  raise FileTypeError(
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import re
4
4
  from pathlib import Path
5
- from typing import Dict, List, Literal
5
+ from typing import List, Dict, Literal
6
6
 
7
7
  from rich import print as rprint
8
8
 
@@ -53,7 +53,7 @@ def create_finetune_request(
53
53
  n_checkpoints: int | None = 1,
54
54
  batch_size: int | Literal["max"] = "max",
55
55
  learning_rate: float | None = 0.00001,
56
- lr_scheduler_type: Literal["linear", "cosine"] = "linear",
56
+ lr_scheduler_type: Literal["linear", "cosine"] = "cosine",
57
57
  min_lr_ratio: float = 0.0,
58
58
  scheduler_num_cycles: float = 0.5,
59
59
  warmup_ratio: float | None = None,
@@ -69,7 +69,7 @@ def create_finetune_request(
69
69
  wandb_base_url: str | None = None,
70
70
  wandb_project_name: str | None = None,
71
71
  wandb_name: str | None = None,
72
- train_on_inputs: bool | Literal["auto"] = "auto",
72
+ train_on_inputs: bool | Literal["auto"] | None = None,
73
73
  training_method: str = "sft",
74
74
  dpo_beta: float | None = None,
75
75
  from_checkpoint: str | None = None,
@@ -101,6 +101,11 @@ def create_finetune_request(
101
101
  raise ValueError(
102
102
  f"LoRA adapters are not supported for the selected model ({model_or_checkpoint})."
103
103
  )
104
+
105
+ if lora_dropout is not None:
106
+ if not 0 <= lora_dropout < 1.0:
107
+ raise ValueError("LoRA dropout must be in [0, 1) range.")
108
+
104
109
  lora_r = lora_r if lora_r is not None else model_limits.lora_training.max_rank
105
110
  lora_alpha = lora_alpha if lora_alpha is not None else lora_r * 2
106
111
  training_type = LoRATrainingType(
@@ -166,6 +171,18 @@ def create_finetune_request(
166
171
  f"training_method must be one of {', '.join(AVAILABLE_TRAINING_METHODS)}"
167
172
  )
168
173
 
174
+ if train_on_inputs is not None and training_method != "sft":
175
+ raise ValueError("train_on_inputs is only supported for SFT training")
176
+
177
+ if train_on_inputs is None and training_method == "sft":
178
+ log_warn_once(
179
+ "train_on_inputs is not set for SFT training, it will be set to 'auto'"
180
+ )
181
+ train_on_inputs = "auto"
182
+
183
+ if dpo_beta is not None and training_method != "dpo":
184
+ raise ValueError("dpo_beta is only supported for DPO training")
185
+
169
186
  lr_scheduler: FinetuneLRScheduler
170
187
  if lr_scheduler_type == "cosine":
171
188
  if scheduler_num_cycles <= 0.0:
@@ -183,8 +200,10 @@ def create_finetune_request(
183
200
  lr_scheduler_args=LinearLRSchedulerArgs(min_lr_ratio=min_lr_ratio),
184
201
  )
185
202
 
186
- training_method_cls: TrainingMethodSFT | TrainingMethodDPO = TrainingMethodSFT()
187
- if training_method == "dpo":
203
+ training_method_cls: TrainingMethodSFT | TrainingMethodDPO
204
+ if training_method == "sft":
205
+ training_method_cls = TrainingMethodSFT(train_on_inputs=train_on_inputs)
206
+ elif training_method == "dpo":
188
207
  training_method_cls = TrainingMethodDPO(dpo_beta=dpo_beta)
189
208
 
190
209
  finetune_request = FinetuneRequest(
@@ -206,7 +225,6 @@ def create_finetune_request(
206
225
  wandb_base_url=wandb_base_url,
207
226
  wandb_project_name=wandb_project_name,
208
227
  wandb_name=wandb_name,
209
- train_on_inputs=train_on_inputs,
210
228
  training_method=training_method_cls,
211
229
  from_checkpoint=from_checkpoint,
212
230
  )
@@ -263,7 +281,7 @@ class FineTuning:
263
281
  n_checkpoints: int | None = 1,
264
282
  batch_size: int | Literal["max"] = "max",
265
283
  learning_rate: float | None = 0.00001,
266
- lr_scheduler_type: Literal["linear", "cosine"] = "linear",
284
+ lr_scheduler_type: Literal["linear", "cosine"] = "cosine",
267
285
  min_lr_ratio: float = 0.0,
268
286
  scheduler_num_cycles: float = 0.5,
269
287
  warmup_ratio: float = 0.0,
@@ -281,7 +299,7 @@ class FineTuning:
281
299
  wandb_name: str | None = None,
282
300
  verbose: bool = False,
283
301
  model_limits: FinetuneTrainingLimits | None = None,
284
- train_on_inputs: bool | Literal["auto"] = "auto",
302
+ train_on_inputs: bool | Literal["auto"] | None = None,
285
303
  training_method: str = "sft",
286
304
  dpo_beta: float | None = None,
287
305
  from_checkpoint: str | None = None,
@@ -300,7 +318,7 @@ class FineTuning:
300
318
  batch_size (int or "max"): Batch size for fine-tuning. Defaults to max.
301
319
  learning_rate (float, optional): Learning rate multiplier to use for training
302
320
  Defaults to 0.00001.
303
- lr_scheduler_type (Literal["linear", "cosine"]): Learning rate scheduler type. Defaults to "linear".
321
+ lr_scheduler_type (Literal["linear", "cosine"]): Learning rate scheduler type. Defaults to "cosine".
304
322
  min_lr_ratio (float, optional): Min learning rate ratio of the initial learning rate for
305
323
  the learning rate scheduler. Defaults to 0.0.
306
324
  scheduler_num_cycles (float, optional): Number or fraction of cycles for the cosine learning rate scheduler. Defaults to 0.5.
@@ -326,12 +344,12 @@ class FineTuning:
326
344
  Defaults to False.
327
345
  model_limits (FinetuneTrainingLimits, optional): Limits for the hyperparameters the model in Fine-tuning.
328
346
  Defaults to None.
329
- train_on_inputs (bool or "auto"): Whether to mask the user messages in conversational data or prompts in instruction data.
347
+ train_on_inputs (bool or "auto", optional): Whether to mask the user messages in conversational data or prompts in instruction data.
330
348
  "auto" will automatically determine whether to mask the inputs based on the data format.
331
349
  For datasets with the "text" field (general format), inputs will not be masked.
332
350
  For datasets with the "messages" field (conversational format) or "prompt" and "completion" fields
333
351
  (Instruction format), inputs will be masked.
334
- Defaults to "auto".
352
+ Defaults to None, or "auto" if training_method is "sft" (set in create_finetune_request).
335
353
  training_method (str, optional): Training method. Defaults to "sft".
336
354
  Supported methods: "sft", "dpo".
337
355
  dpo_beta (float, optional): DPO beta parameter. Defaults to None.
@@ -545,7 +563,7 @@ class FineTuning:
545
563
  *,
546
564
  output: Path | str | None = None,
547
565
  checkpoint_step: int | None = None,
548
- checkpoint_type: DownloadCheckpointType = DownloadCheckpointType.DEFAULT,
566
+ checkpoint_type: DownloadCheckpointType | str = DownloadCheckpointType.DEFAULT,
549
567
  ) -> FinetuneDownloadResult:
550
568
  """
551
569
  Downloads compressed fine-tuned model or checkpoint to local disk.
@@ -558,7 +576,7 @@ class FineTuning:
558
576
  Defaults to None.
559
577
  checkpoint_step (int, optional): Specifies step number for checkpoint to download.
560
578
  Defaults to -1 (download the final model)
561
- checkpoint_type (CheckpointType, optional): Specifies which checkpoint to download.
579
+ checkpoint_type (CheckpointType | str, optional): Specifies which checkpoint to download.
562
580
  Defaults to CheckpointType.DEFAULT.
563
581
 
564
582
  Returns:
@@ -582,6 +600,16 @@ class FineTuning:
582
600
 
583
601
  ft_job = self.retrieve(id)
584
602
 
603
+ # convert str to DownloadCheckpointType
604
+ if isinstance(checkpoint_type, str):
605
+ try:
606
+ checkpoint_type = DownloadCheckpointType(checkpoint_type.lower())
607
+ except ValueError:
608
+ enum_strs = ", ".join(e.value for e in DownloadCheckpointType)
609
+ raise ValueError(
610
+ f"Invalid checkpoint type: {checkpoint_type}. Choose one of {{{enum_strs}}}."
611
+ )
612
+
585
613
  if isinstance(ft_job.training_type, FullTrainingType):
586
614
  if checkpoint_type != DownloadCheckpointType.DEFAULT:
587
615
  raise ValueError(
@@ -592,10 +620,11 @@ class FineTuning:
592
620
  if checkpoint_type == DownloadCheckpointType.DEFAULT:
593
621
  checkpoint_type = DownloadCheckpointType.MERGED
594
622
 
595
- if checkpoint_type == DownloadCheckpointType.MERGED:
596
- url += f"&checkpoint={DownloadCheckpointType.MERGED.value}"
597
- elif checkpoint_type == DownloadCheckpointType.ADAPTER:
598
- url += f"&checkpoint={DownloadCheckpointType.ADAPTER.value}"
623
+ if checkpoint_type in {
624
+ DownloadCheckpointType.MERGED,
625
+ DownloadCheckpointType.ADAPTER,
626
+ }:
627
+ url += f"&checkpoint={checkpoint_type.value}"
599
628
  else:
600
629
  raise ValueError(
601
630
  f"Invalid checkpoint type for LoRATrainingType: {checkpoint_type}"
@@ -664,7 +693,7 @@ class AsyncFineTuning:
664
693
  n_checkpoints: int | None = 1,
665
694
  batch_size: int | Literal["max"] = "max",
666
695
  learning_rate: float | None = 0.00001,
667
- lr_scheduler_type: Literal["linear", "cosine"] = "linear",
696
+ lr_scheduler_type: Literal["linear", "cosine"] = "cosine",
668
697
  min_lr_ratio: float = 0.0,
669
698
  scheduler_num_cycles: float = 0.5,
670
699
  warmup_ratio: float = 0.0,
@@ -682,7 +711,7 @@ class AsyncFineTuning:
682
711
  wandb_name: str | None = None,
683
712
  verbose: bool = False,
684
713
  model_limits: FinetuneTrainingLimits | None = None,
685
- train_on_inputs: bool | Literal["auto"] = "auto",
714
+ train_on_inputs: bool | Literal["auto"] | None = None,
686
715
  training_method: str = "sft",
687
716
  dpo_beta: float | None = None,
688
717
  from_checkpoint: str | None = None,
@@ -701,7 +730,7 @@ class AsyncFineTuning:
701
730
  batch_size (int, optional): Batch size for fine-tuning. Defaults to max.
702
731
  learning_rate (float, optional): Learning rate multiplier to use for training
703
732
  Defaults to 0.00001.
704
- lr_scheduler_type (Literal["linear", "cosine"]): Learning rate scheduler type. Defaults to "linear".
733
+ lr_scheduler_type (Literal["linear", "cosine"]): Learning rate scheduler type. Defaults to "cosine".
705
734
  min_lr_ratio (float, optional): Min learning rate ratio of the initial learning rate for
706
735
  the learning rate scheduler. Defaults to 0.0.
707
736
  scheduler_num_cycles (float, optional): Number or fraction of cycles for the cosine learning rate scheduler. Defaults to 0.5.
@@ -732,7 +761,7 @@ class AsyncFineTuning:
732
761
  For datasets with the "text" field (general format), inputs will not be masked.
733
762
  For datasets with the "messages" field (conversational format) or "prompt" and "completion" fields
734
763
  (Instruction format), inputs will be masked.
735
- Defaults to "auto".
764
+ Defaults to None, or "auto" if training_method is "sft" (set in create_finetune_request).
736
765
  training_method (str, optional): Training method. Defaults to "sft".
737
766
  Supported methods: "sft", "dpo".
738
767
  dpo_beta (float, optional): DPO beta parameter. Defaults to None.
@@ -52,6 +52,7 @@ from together.types.finetune import (
52
52
  from together.types.images import ImageRequest, ImageResponse
53
53
  from together.types.models import ModelObject
54
54
  from together.types.rerank import RerankRequest, RerankResponse
55
+ from together.types.batch import BatchJob, BatchJobStatus, BatchEndpoint
55
56
 
56
57
 
57
58
  __all__ = [
@@ -104,4 +105,7 @@ __all__ = [
104
105
  "DedicatedEndpoint",
105
106
  "ListEndpoint",
106
107
  "Autoscaling",
108
+ "BatchJob",
109
+ "BatchJobStatus",
110
+ "BatchEndpoint",
107
111
  ]
@@ -0,0 +1,53 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+ from typing import Optional
5
+ from datetime import datetime
6
+
7
+ from pydantic import Field
8
+
9
+ from together.types.abstract import BaseModel
10
+
11
+
12
+ class BatchJobStatus(str, Enum):
13
+ """
14
+ The status of a batch job
15
+ """
16
+
17
+ VALIDATING = "VALIDATING"
18
+ IN_PROGRESS = "IN_PROGRESS"
19
+ COMPLETED = "COMPLETED"
20
+ FAILED = "FAILED"
21
+ EXPIRED = "EXPIRED"
22
+ CANCELLED = "CANCELLED"
23
+
24
+
25
+ class BatchEndpoint(str, Enum):
26
+ """
27
+ The endpoint of a batch job
28
+ """
29
+
30
+ COMPLETIONS = "/v1/completions"
31
+ CHAT_COMPLETIONS = "/v1/chat/completions"
32
+ # More endpoints can be added here as needed
33
+
34
+
35
+ class BatchJob(BaseModel):
36
+ """
37
+ A batch job object
38
+ """
39
+
40
+ id: str
41
+ user_id: str
42
+ input_file_id: str
43
+ file_size_bytes: int
44
+ status: BatchJobStatus
45
+ job_deadline: datetime
46
+ created_at: datetime
47
+ endpoint: str
48
+ progress: float = 0.0
49
+ model_id: Optional[str] = None
50
+ output_file_id: Optional[str] = None
51
+ error_file_id: Optional[str] = None
52
+ error: Optional[str] = None
53
+ completed_at: Optional[datetime] = None
together/types/files.py CHANGED
@@ -13,6 +13,7 @@ from together.types.common import (
13
13
 
14
14
  class FilePurpose(str, Enum):
15
15
  FineTune = "fine-tune"
16
+ BatchAPI = "batch-api"
16
17
 
17
18
 
18
19
  class FileType(str, Enum):
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  from enum import Enum
4
4
  from typing import List, Literal, Any
5
5
 
6
- from pydantic import StrictBool, Field, field_validator
6
+ from pydantic import Field, StrictBool, field_validator
7
7
 
8
8
  from together.types.abstract import BaseModel
9
9
  from together.types.common import (
@@ -149,6 +149,7 @@ class TrainingMethodSFT(TrainingMethod):
149
149
  """
150
150
 
151
151
  method: Literal["sft"] = "sft"
152
+ train_on_inputs: StrictBool | Literal["auto"] = "auto"
152
153
 
153
154
 
154
155
  class TrainingMethodDPO(TrainingMethod):
@@ -201,8 +202,6 @@ class FinetuneRequest(BaseModel):
201
202
  wandb_name: str | None = None
202
203
  # training type
203
204
  training_type: FullTrainingType | LoRATrainingType | None = None
204
- # train on inputs
205
- train_on_inputs: StrictBool | Literal["auto"] = "auto"
206
205
  # training method
207
206
  training_method: TrainingMethodSFT | TrainingMethodDPO = Field(
208
207
  default_factory=TrainingMethodSFT
together/utils/files.py CHANGED
@@ -6,7 +6,6 @@ from pathlib import Path
6
6
  from traceback import format_exc
7
7
  from typing import Any, Dict, List
8
8
 
9
- from pyarrow import ArrowInvalid, parquet
10
9
 
11
10
  from together.constants import (
12
11
  MAX_FILE_SIZE_GB,
@@ -372,6 +371,14 @@ def _check_jsonl(file: Path) -> Dict[str, Any]:
372
371
 
373
372
 
374
373
  def _check_parquet(file: Path) -> Dict[str, Any]:
374
+ try:
375
+ # Pyarrow is optional as it's large (~80MB) and isn't compatible with older systems.
376
+ from pyarrow import ArrowInvalid, parquet
377
+ except ImportError:
378
+ raise ImportError(
379
+ "pyarrow is not installed and is required to use parquet files. Please install it via `pip install together[pyarrow]`"
380
+ )
381
+
375
382
  report_dict: Dict[str, Any] = {}
376
383
 
377
384
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: together
3
- Version: 1.5.8
3
+ Version: 1.5.13
4
4
  Summary: Python client for Together's Cloud Platform!
5
5
  License: Apache-2.0
6
6
  Author: Together AI
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Provides-Extra: pyarrow
16
17
  Requires-Dist: aiohttp (>=3.9.3,<4.0.0)
17
18
  Requires-Dist: click (>=8.1.7,<9.0.0)
18
19
  Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
@@ -20,7 +21,7 @@ Requires-Dist: filelock (>=3.13.1,<4.0.0)
20
21
  Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
21
22
  Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
22
23
  Requires-Dist: pillow (>=11.1.0,<12.0.0)
23
- Requires-Dist: pyarrow (>=10.0.1)
24
+ Requires-Dist: pyarrow (>=10.0.1) ; extra == "pyarrow"
24
25
  Requires-Dist: pydantic (>=2.6.3,<3.0.0)
25
26
  Requires-Dist: requests (>=2.31.0,<3.0.0)
26
27
  Requires-Dist: rich (>=13.8.1,<15.0.0)
@@ -92,7 +93,7 @@ client = Together()
92
93
 
93
94
  # Simple text message
94
95
  response = client.chat.completions.create(
95
- model="mistralai/Mixtral-8x7B-Instruct-v0.1",
96
+ model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
96
97
  messages=[{"role": "user", "content": "tell me about new york"}],
97
98
  )
98
99
  print(response.choices[0].message.content)
@@ -182,7 +183,7 @@ from together import Together
182
183
 
183
184
  client = Together()
184
185
  stream = client.chat.completions.create(
185
- model="mistralai/Mixtral-8x7B-Instruct-v0.1",
186
+ model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
186
187
  messages=[{"role": "user", "content": "tell me about new york"}],
187
188
  stream=True,
188
189
  )
@@ -207,7 +208,7 @@ async def async_chat_completion(messages):
207
208
  async_client = AsyncTogether()
208
209
  tasks = [
209
210
  async_client.chat.completions.create(
210
- model="mistralai/Mixtral-8x7B-Instruct-v0.1",
211
+ model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
211
212
  messages=[{"role": "user", "content": message}],
212
213
  )
213
214
  for message in messages
@@ -230,7 +231,7 @@ from together import Together
230
231
  client = Together()
231
232
 
232
233
  response = client.chat.completions.create(
233
- model="mistralai/Mixtral-8x7B-Instruct-v0.1",
234
+ model="meta-llama/Llama-3.2-3B-Instruct-Turbo",
234
235
  messages=[{"role": "user", "content": "tell me about new york"}],
235
236
  logprobs=1
236
237
  )
@@ -381,7 +382,7 @@ client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a
381
382
 
382
383
  ### Fine-tunes
383
384
 
384
- The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrive statuses and get checkpoints. Please refer to our fine-tuning docs [here](https://docs.together.ai/docs/fine-tuning-python).
385
+ The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrive statuses and get checkpoints. Please refer to our fine-tuning docs [here](https://docs.together.ai/docs/fine-tuning-quickstart).
385
386
 
386
387
  ```python
387
388
  from together import Together
@@ -390,7 +391,7 @@ client = Together()
390
391
 
391
392
  client.fine_tuning.create(
392
393
  training_file = 'file-d0d318cb-b7d9-493a-bd70-1cfe089d3815',
393
- model = 'mistralai/Mixtral-8x7B-Instruct-v0.1',
394
+ model = 'meta-llama/Llama-3.2-3B-Instruct',
394
395
  n_epochs = 3,
395
396
  n_checkpoints = 1,
396
397
  batch_size = "max",
@@ -428,7 +429,7 @@ for model in models:
428
429
  together chat.completions \
429
430
  --message "system" "You are a helpful assistant named Together" \
430
431
  --message "user" "What is your name?" \
431
- --model mistralai/Mixtral-8x7B-Instruct-v0.1
432
+ --model meta-llama/Llama-4-Scout-17B-16E-Instruct
432
433
  ```
433
434
 
434
435
  The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
@@ -438,7 +439,7 @@ The Chat Completions CLI enables streaming tokens to stdout by default. To disab
438
439
  ```bash
439
440
  together completions \
440
441
  "Large language models are " \
441
- --model mistralai/Mixtral-8x7B-v0.1 \
442
+ --model meta-llama/Llama-4-Scout-17B-16E-Instruct \
442
443
  --max-tokens 512 \
443
444
  --stop "."
444
445
  ```
@@ -5,14 +5,14 @@ together/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  together/cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  together/cli/api/chat.py,sha256=2PHRb-9T-lUEKhUJFtc7SxJv3shCVx40gq_8pzfsewM,9234
7
7
  together/cli/api/completions.py,sha256=l-Zw5t7hojL3w8xd_mitS2NRB72i5Z0xwkzH0rT5XMc,4263
8
- together/cli/api/endpoints.py,sha256=tM42PthzkpTjOkmL6twyWYXqEQw0DOqsEKTZdhp6vKU,13284
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=AnVa5sDB4ZCR_S-CMJStj1vzi0b2AwYQT2c3rkUnAbQ,16238
10
+ together/cli/api/finetune.py,sha256=mM8GF6xP-NM-eOQfn8eXBCLop77OesLVaATAfKm_HMo,16238
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
14
14
  together/cli/cli.py,sha256=YCDzbXpC5is0rs2PEkUPrIhYuzdyrihQ8GVR_TlDv5s,2054
15
- together/client.py,sha256=lN_KfJs2gCdLfQ5GBrVKin-4ZL7L7UQf9wjofWQ7sXg,5682
15
+ together/client.py,sha256=us5aE8hVzKmMCHZz52NcSPXByOsigd2sKbbyqe4x1m0,5861
16
16
  together/constants.py,sha256=UDJhEylJFmdm4bedBDpvqYXBj5Or3k7z9GWtkRY_dZQ,1526
17
17
  together/error.py,sha256=HU6247CyzCFjaxL9A0XYbXZ6fY_ebRg0FEYjI4Skogs,5515
18
18
  together/filemanager.py,sha256=lwNIYm-BAcnUPtyE0Q_8NpRNsxMlQrpIWFVUVJBBz88,11356
@@ -24,24 +24,26 @@ together/legacy/files.py,sha256=qmAqMiNTPWb6WvLV5Tsv6kxGRfQ31q7OkHZNFwkw8v0,4082
24
24
  together/legacy/finetune.py,sha256=XjZ4Dn2hSjMUVm64s6u1bbh9F7r9GbDKp-WLmzyEKRw,5123
25
25
  together/legacy/images.py,sha256=bJJRs-6C7-NexPyaeyHiYlHOU51yls5-QAiqtO4xrZU,626
26
26
  together/legacy/models.py,sha256=85ZN9Ids_FjdYNDRv5k7sgrtVWPKPHqkDplORtVUGHg,1087
27
- together/resources/__init__.py,sha256=OQ8tW9mUIX0Ezk0wvYEnnEym6wGsjBKgXFLU9Ffgb-o,984
27
+ together/resources/__init__.py,sha256=jZ9O14K7wKb1U0bmIMosa9P3W3xPCJhoEJiaHw8anCc,1078
28
28
  together/resources/audio/__init__.py,sha256=e7xp0Lkp_nMAHXcuFHS7dLXP_YqTPMMZIilW1TW_sAI,551
29
29
  together/resources/audio/speech.py,sha256=81ib_gIo-Rxoaipx2Pi9ZsKnOTjeFPwSlBrcUkyX5xk,5211
30
+ together/resources/batch.py,sha256=wSJR30CAFjzZ436vjYdXLCT0ahA5E0ud_qHMS5YvZ1M,3750
30
31
  together/resources/chat/__init__.py,sha256=RsTptdP8MeGjcdIjze896-J27cRvCbUoMft0X2BVlQ8,617
31
32
  together/resources/chat/completions.py,sha256=jYiNZsWa8RyEacL0VgxWj1egJ857oU4nxIY8uqGHcaU,14459
32
33
  together/resources/code_interpreter.py,sha256=vbN8Mh5MG6HQvqra7p61leIyfebgbgJTM_q2A_Fylhw,2948
33
34
  together/resources/completions.py,sha256=5Wa-ZjPCxRcam6CDe7KgGYlTA7yJZMmd5TrRgGCL_ug,11726
34
35
  together/resources/embeddings.py,sha256=PTvLb82yjG_-iQOyuhsilp77Fr7gZ0o6WD2KeRnKoxs,2675
35
36
  together/resources/endpoints.py,sha256=NNjp-wyzOotzlscGGrANhOHxQBjHTN8f5kTQTH_CLvE,17177
36
- together/resources/files.py,sha256=bnPbaF25e4InBRPvHwXHXT-oSX1Z1sZRsnQW5wq82U4,4990
37
- together/resources/finetune.py,sha256=6Al4QfqNid_1blWShl1RR9uis0xwrGruITc5Uxr_jkA,36367
37
+ together/resources/files.py,sha256=y3Ri6UtyAa7fjCJ8_fp26Y2hzzi6Aoo21JKkVgljFl8,5026
38
+ together/resources/finetune.py,sha256=M-nvOZMnL7ZyTayiKN9Vos8D1uYNj-ENmrOA2bkPF8A,37617
38
39
  together/resources/images.py,sha256=LQUjKPaFxWTqOAPnyF1Pp7Rz4NLOYhmoKwshpYiprEM,4923
39
40
  together/resources/models.py,sha256=qgmAXv61Cq4oLxytenEZBywA8shldDHYxJ_EAu_4JWQ,3864
40
41
  together/resources/rerank.py,sha256=3Ju_aRSyZ1s_3zCSNZnSnEJErUVmt2xa3M8z1nvejMA,3931
41
42
  together/together_response.py,sha256=a3dgKMPDrlfKQwxYENfNt2T4l2vSZxRWMixhHSy-q3E,1308
42
- together/types/__init__.py,sha256=VgIbE2AOK9c2TQUzkbRbyRkdia2COXJXl_wxPaoxR-M,2688
43
+ together/types/__init__.py,sha256=_93XstLg1OOWratj_N1bsNN-2aS628uHH3SZj0wszyc,2820
43
44
  together/types/abstract.py,sha256=1lFQI_3WjsR_t1128AeKW0aTk6EiM6Gh1J3ZuyLLPao,642
44
45
  together/types/audio_speech.py,sha256=jlj8BZf3dkIDARF1P11fuenVLj4try8Yx4RN-EAkhOU,2609
46
+ together/types/batch.py,sha256=FP0RuQ3EDy-FV1bh-biPICvyRS7WqLm38GHz5lzKyXM,1112
45
47
  together/types/chat_completions.py,sha256=qpBCMXEWtRwW_fmiu6cecm3d4h6mcK8gvr-8JkbAopQ,5104
46
48
  together/types/code_interpreter.py,sha256=cjF8TKgRkJllHS4i24dWQZBGTRsG557eHSewOiip0Kk,1770
47
49
  together/types/common.py,sha256=kxZ-N9xtBsGYZBmbIWnZ0rfT3Pn8PFB7sAbp3iv96pw,1525
@@ -49,19 +51,19 @@ together/types/completions.py,sha256=o3FR5ixsTUj-a3pmOUzbSQg-hESVhpqrC9UD__VCqr4
49
51
  together/types/embeddings.py,sha256=J7grkYYn7xhqeKaBO2T-8XQRtHhkzYzymovtGdIUK5A,751
50
52
  together/types/endpoints.py,sha256=EzNhHOoQ_D9fUdNQtxQPeSWiFzdFLqpNodN0YLmv_h0,4393
51
53
  together/types/error.py,sha256=OVlCs3cx_2WhZK4JzHT8SQyRIIqKOP1AZQ4y1PydjAE,370
52
- together/types/files.py,sha256=-rEUfsV6f2vZB9NrFxT4_933ubsDIUNkPB-3OlOFk4A,1954
53
- together/types/finetune.py,sha256=KVaos9wBjFZFvVoL4DBx3PlXjGAx7_0CTQxKzEZzf40,10940
54
+ together/types/files.py,sha256=i-Ke57p8Svb1MbMZxu-Fo2zxIc6j-mDO2TLGNwPpGu0,1981
55
+ together/types/finetune.py,sha256=Utdcm3kL_cDfBS3zjXwyHsuP2qFFjCQiQZOsPD-WlpE,10918
54
56
  together/types/images.py,sha256=xnC-FZGdZU30WSFTybfGneWxb-kj0ZGufJsgHtB8j0k,980
55
57
  together/types/models.py,sha256=nwQIZGHKZpX9I6mK8z56VW70YC6Ry6JGsVa0s99QVxc,1055
56
58
  together/types/rerank.py,sha256=qZfuXOn7MZ6ly8hpJ_MZ7OU_Bi1-cgYNSB20Wja8Qkk,1061
57
59
  together/utils/__init__.py,sha256=5fqvj4KT2rHxKSQot2TSyV_HcvkvkGiqAiaYuJwqtm0,786
58
60
  together/utils/_log.py,sha256=5IYNI-jYzxyIS-pUvhb0vE_Muo3MA7GgBhsu66TKP2w,1951
59
61
  together/utils/api_helpers.py,sha256=2K0O6qeEQ2zVFvi5NBN5m2kjZJaS3-JfKFecQ7SmGaw,3746
60
- together/utils/files.py,sha256=rfp10qU0urtWOXXFeasFtO9xp-1KIhM3S43JxcnHmL0,16438
62
+ together/utils/files.py,sha256=btWQawwXbNKfPmCtRyObZViG1Xx-IPz45PrAtMXvcy8,16741
61
63
  together/utils/tools.py,sha256=H2MTJhEqtBllaDvOyZehIO_IVNK3P17rSDeILtJIVag,2964
62
64
  together/version.py,sha256=p03ivHyE0SyWU4jAnRTBi_sOwywVWoZPU4g2gzRgG-Y,126
63
- together-1.5.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
- together-1.5.8.dist-info/METADATA,sha256=lsO8JDj10zXplEJu-tVmwkMXNFLOE6RDQ6GQLYhBCXs,15415
65
- together-1.5.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
66
- together-1.5.8.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
67
- together-1.5.8.dist-info/RECORD,,
65
+ together-1.5.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
66
+ together-1.5.13.dist-info/METADATA,sha256=pH3dlk_0LIhPs8Z6HW5xnGFPLnxTT7t_-WA3WP4tp1s,15497
67
+ together-1.5.13.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
68
+ together-1.5.13.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
69
+ together-1.5.13.dist-info/RECORD,,