together 1.2.11__py3-none-any.whl → 2.0.0a8__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/__init__.py +101 -63
- together/_base_client.py +1995 -0
- together/_client.py +1033 -0
- together/_compat.py +219 -0
- together/_constants.py +14 -0
- together/_exceptions.py +108 -0
- together/_files.py +123 -0
- together/_models.py +857 -0
- together/_qs.py +150 -0
- together/_resource.py +43 -0
- together/_response.py +830 -0
- together/_streaming.py +370 -0
- together/_types.py +260 -0
- together/_utils/__init__.py +64 -0
- together/_utils/_compat.py +45 -0
- together/_utils/_datetime_parse.py +136 -0
- together/_utils/_logs.py +25 -0
- together/_utils/_proxy.py +65 -0
- together/_utils/_reflection.py +42 -0
- together/_utils/_resources_proxy.py +24 -0
- together/_utils/_streams.py +12 -0
- together/_utils/_sync.py +58 -0
- together/_utils/_transform.py +457 -0
- together/_utils/_typing.py +156 -0
- together/_utils/_utils.py +421 -0
- together/_version.py +4 -0
- together/lib/.keep +4 -0
- together/lib/__init__.py +23 -0
- together/lib/cli/api/endpoints.py +467 -0
- together/lib/cli/api/evals.py +588 -0
- together/{cli → lib/cli}/api/files.py +20 -17
- together/lib/cli/api/fine_tuning.py +566 -0
- together/lib/cli/api/models.py +140 -0
- together/lib/cli/api/utils.py +50 -0
- together/{cli → lib/cli}/cli.py +17 -23
- together/lib/constants.py +61 -0
- together/lib/resources/__init__.py +11 -0
- together/lib/resources/files.py +999 -0
- together/lib/resources/fine_tuning.py +280 -0
- together/lib/resources/models.py +35 -0
- together/lib/types/__init__.py +13 -0
- together/lib/types/error.py +9 -0
- together/lib/types/fine_tuning.py +455 -0
- together/{utils → lib/utils}/__init__.py +7 -10
- together/{utils → lib/utils}/_log.py +18 -13
- together/lib/utils/files.py +628 -0
- together/lib/utils/serializer.py +10 -0
- together/{utils → lib/utils}/tools.py +17 -2
- together/resources/__init__.py +225 -24
- together/resources/audio/__init__.py +75 -0
- together/resources/audio/audio.py +198 -0
- together/resources/audio/speech.py +605 -0
- together/resources/audio/transcriptions.py +282 -0
- together/resources/audio/translations.py +256 -0
- together/resources/audio/voices.py +135 -0
- together/resources/batches.py +417 -0
- together/resources/chat/__init__.py +30 -21
- together/resources/chat/chat.py +102 -0
- together/resources/chat/completions.py +1063 -257
- together/resources/code_interpreter/__init__.py +33 -0
- together/resources/code_interpreter/code_interpreter.py +258 -0
- together/resources/code_interpreter/sessions.py +135 -0
- together/resources/completions.py +890 -225
- together/resources/embeddings.py +172 -68
- together/resources/endpoints.py +711 -0
- together/resources/evals.py +452 -0
- together/resources/files.py +397 -120
- together/resources/fine_tuning.py +1033 -0
- together/resources/hardware.py +181 -0
- together/resources/images.py +256 -108
- together/resources/jobs.py +214 -0
- together/resources/models.py +251 -44
- together/resources/rerank.py +190 -92
- together/resources/videos.py +374 -0
- together/types/__init__.py +66 -73
- together/types/audio/__init__.py +10 -0
- together/types/audio/speech_create_params.py +75 -0
- together/types/audio/transcription_create_params.py +54 -0
- together/types/audio/transcription_create_response.py +111 -0
- together/types/audio/translation_create_params.py +40 -0
- together/types/audio/translation_create_response.py +70 -0
- together/types/audio/voice_list_response.py +23 -0
- together/types/audio_speech_stream_chunk.py +16 -0
- together/types/autoscaling.py +13 -0
- together/types/autoscaling_param.py +15 -0
- together/types/batch_create_params.py +24 -0
- together/types/batch_create_response.py +14 -0
- together/types/batch_job.py +45 -0
- together/types/batch_list_response.py +10 -0
- together/types/chat/__init__.py +18 -0
- together/types/chat/chat_completion.py +60 -0
- together/types/chat/chat_completion_chunk.py +61 -0
- together/types/chat/chat_completion_structured_message_image_url_param.py +18 -0
- together/types/chat/chat_completion_structured_message_text_param.py +13 -0
- together/types/chat/chat_completion_structured_message_video_url_param.py +18 -0
- together/types/chat/chat_completion_usage.py +13 -0
- together/types/chat/chat_completion_warning.py +9 -0
- together/types/chat/completion_create_params.py +329 -0
- together/types/code_interpreter/__init__.py +5 -0
- together/types/code_interpreter/session_list_response.py +31 -0
- together/types/code_interpreter_execute_params.py +45 -0
- together/types/completion.py +42 -0
- together/types/completion_chunk.py +66 -0
- together/types/completion_create_params.py +138 -0
- together/types/dedicated_endpoint.py +44 -0
- together/types/embedding.py +24 -0
- together/types/embedding_create_params.py +31 -0
- together/types/endpoint_create_params.py +43 -0
- together/types/endpoint_list_avzones_response.py +11 -0
- together/types/endpoint_list_params.py +18 -0
- together/types/endpoint_list_response.py +41 -0
- together/types/endpoint_update_params.py +27 -0
- together/types/eval_create_params.py +263 -0
- together/types/eval_create_response.py +16 -0
- together/types/eval_list_params.py +21 -0
- together/types/eval_list_response.py +10 -0
- together/types/eval_status_response.py +100 -0
- together/types/evaluation_job.py +139 -0
- together/types/execute_response.py +108 -0
- together/types/file_delete_response.py +13 -0
- together/types/file_list.py +12 -0
- together/types/file_purpose.py +9 -0
- together/types/file_response.py +31 -0
- together/types/file_type.py +7 -0
- together/types/fine_tuning_cancel_response.py +194 -0
- together/types/fine_tuning_content_params.py +24 -0
- together/types/fine_tuning_delete_params.py +11 -0
- together/types/fine_tuning_delete_response.py +12 -0
- together/types/fine_tuning_list_checkpoints_response.py +21 -0
- together/types/fine_tuning_list_events_response.py +12 -0
- together/types/fine_tuning_list_response.py +199 -0
- together/types/finetune_event.py +41 -0
- together/types/finetune_event_type.py +33 -0
- together/types/finetune_response.py +177 -0
- together/types/hardware_list_params.py +16 -0
- together/types/hardware_list_response.py +58 -0
- together/types/image_data_b64.py +15 -0
- together/types/image_data_url.py +15 -0
- together/types/image_file.py +23 -0
- together/types/image_generate_params.py +85 -0
- together/types/job_list_response.py +47 -0
- together/types/job_retrieve_response.py +43 -0
- together/types/log_probs.py +18 -0
- together/types/model_list_response.py +10 -0
- together/types/model_object.py +42 -0
- together/types/model_upload_params.py +36 -0
- together/types/model_upload_response.py +23 -0
- together/types/rerank_create_params.py +36 -0
- together/types/rerank_create_response.py +36 -0
- together/types/tool_choice.py +23 -0
- together/types/tool_choice_param.py +23 -0
- together/types/tools_param.py +23 -0
- together/types/training_method_dpo.py +22 -0
- together/types/training_method_sft.py +18 -0
- together/types/video_create_params.py +86 -0
- together/types/video_job.py +57 -0
- together-2.0.0a8.dist-info/METADATA +680 -0
- together-2.0.0a8.dist-info/RECORD +164 -0
- {together-1.2.11.dist-info → together-2.0.0a8.dist-info}/WHEEL +1 -1
- together-2.0.0a8.dist-info/entry_points.txt +2 -0
- {together-1.2.11.dist-info → together-2.0.0a8.dist-info/licenses}/LICENSE +1 -1
- together/abstract/api_requestor.py +0 -723
- together/cli/api/chat.py +0 -276
- together/cli/api/completions.py +0 -119
- together/cli/api/finetune.py +0 -272
- together/cli/api/images.py +0 -82
- together/cli/api/models.py +0 -42
- together/client.py +0 -157
- together/constants.py +0 -31
- together/error.py +0 -191
- together/filemanager.py +0 -388
- together/legacy/__init__.py +0 -0
- together/legacy/base.py +0 -27
- together/legacy/complete.py +0 -93
- together/legacy/embeddings.py +0 -27
- together/legacy/files.py +0 -146
- together/legacy/finetune.py +0 -177
- together/legacy/images.py +0 -27
- together/legacy/models.py +0 -44
- together/resources/finetune.py +0 -489
- together/together_response.py +0 -50
- together/types/abstract.py +0 -26
- together/types/chat_completions.py +0 -171
- together/types/common.py +0 -65
- together/types/completions.py +0 -104
- together/types/embeddings.py +0 -35
- together/types/error.py +0 -16
- together/types/files.py +0 -89
- together/types/finetune.py +0 -265
- together/types/images.py +0 -42
- together/types/models.py +0 -44
- together/types/rerank.py +0 -43
- together/utils/api_helpers.py +0 -84
- together/utils/files.py +0 -204
- together/version.py +0 -6
- together-1.2.11.dist-info/METADATA +0 -408
- together-1.2.11.dist-info/RECORD +0 -58
- together-1.2.11.dist-info/entry_points.txt +0 -3
- /together/{abstract → lib/cli}/__init__.py +0 -0
- /together/{cli → lib/cli/api}/__init__.py +0 -0
- /together/{cli/api/__init__.py → py.typed} +0 -0
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: together
|
|
3
|
-
Version: 1.2.11
|
|
4
|
-
Summary: Python client for Together's Cloud Platform!
|
|
5
|
-
Home-page: https://github.com/togethercomputer/together-python
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Author: Together AI
|
|
8
|
-
Author-email: support@together.ai
|
|
9
|
-
Requires-Python: >=3.8,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
-
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Requires-Dist: aiohttp (>=3.9.3,<4.0.0)
|
|
19
|
-
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
20
|
-
Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
|
|
21
|
-
Requires-Dist: filelock (>=3.13.1,<4.0.0)
|
|
22
|
-
Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
|
|
23
|
-
Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
|
|
24
|
-
Requires-Dist: pillow (>=10.3.0,<11.0.0)
|
|
25
|
-
Requires-Dist: pyarrow (>=10.0.1)
|
|
26
|
-
Requires-Dist: pydantic (>=2.6.3,<3.0.0)
|
|
27
|
-
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
28
|
-
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
|
29
|
-
Requires-Dist: tqdm (>=4.66.2,<5.0.0)
|
|
30
|
-
Requires-Dist: typer (>=0.9,<0.13)
|
|
31
|
-
Project-URL: Bug Tracker, https://github.com/togethercomputer/together-python/issues
|
|
32
|
-
Project-URL: Repository, https://github.com/togethercomputer/together-python
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
|
|
35
|
-
<div align="center">
|
|
36
|
-
<a href="https://www.together.ai/">
|
|
37
|
-
<img alt="together.ai" height="100px" src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg">
|
|
38
|
-
</a>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
# Together Python API library
|
|
42
|
-
|
|
43
|
-
[](https://pypi.org/project/together/)
|
|
44
|
-
[](https://discord.com/invite/9Rk6sSeWEG)
|
|
45
|
-
[](https://twitter.com/togethercompute)
|
|
46
|
-
|
|
47
|
-
The [Together Python API Library](https://pypi.org/project/together/) is the official Python client for Together's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.8+ applications with easy to use synchronous and asynchronous clients.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Installation
|
|
52
|
-
|
|
53
|
-
> 🚧
|
|
54
|
-
> The Library was rewritten in v1.0.0 released in April of 2024. There were significant changes made.
|
|
55
|
-
|
|
56
|
-
To install Together Python Library from PyPI, simply run:
|
|
57
|
-
|
|
58
|
-
```shell Shell
|
|
59
|
-
pip install --upgrade together
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Setting up API Key
|
|
63
|
-
|
|
64
|
-
> 🚧 You will need to create an account with [Together.ai](https://api.together.xyz/) to obtain a Together API Key.
|
|
65
|
-
|
|
66
|
-
Once logged in to the Together Playground, you can find available API keys in [this settings page](https://api.together.xyz/settings/api-keys).
|
|
67
|
-
|
|
68
|
-
#### Setting environment variable
|
|
69
|
-
|
|
70
|
-
```shell
|
|
71
|
-
export TOGETHER_API_KEY=xxxxx
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
#### Using the client
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
from together import Together
|
|
78
|
-
|
|
79
|
-
client = Together(api_key="xxxxx")
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
This repo contains both a Python Library and a CLI. We'll demonstrate how to use both below.
|
|
83
|
-
|
|
84
|
-
## Usage – Python Client
|
|
85
|
-
|
|
86
|
-
### Chat Completions
|
|
87
|
-
|
|
88
|
-
```python
|
|
89
|
-
import os
|
|
90
|
-
from together import Together
|
|
91
|
-
|
|
92
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
93
|
-
|
|
94
|
-
response = client.chat.completions.create(
|
|
95
|
-
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
96
|
-
messages=[{"role": "user", "content": "tell me about new york"}],
|
|
97
|
-
)
|
|
98
|
-
print(response.choices[0].message.content)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
#### Streaming
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
import os
|
|
105
|
-
from together import Together
|
|
106
|
-
|
|
107
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
108
|
-
stream = client.chat.completions.create(
|
|
109
|
-
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
110
|
-
messages=[{"role": "user", "content": "tell me about new york"}],
|
|
111
|
-
stream=True,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
for chunk in stream:
|
|
115
|
-
print(chunk.choices[0].delta.content or "", end="", flush=True)
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### Async usage
|
|
119
|
-
|
|
120
|
-
```python
|
|
121
|
-
import os, asyncio
|
|
122
|
-
from together import AsyncTogether
|
|
123
|
-
|
|
124
|
-
async_client = AsyncTogether(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
125
|
-
messages = [
|
|
126
|
-
"What are the top things to do in San Francisco?",
|
|
127
|
-
"What country is Paris in?",
|
|
128
|
-
]
|
|
129
|
-
|
|
130
|
-
async def async_chat_completion(messages):
|
|
131
|
-
async_client = AsyncTogether(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
132
|
-
tasks = [
|
|
133
|
-
async_client.chat.completions.create(
|
|
134
|
-
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
135
|
-
messages=[{"role": "user", "content": message}],
|
|
136
|
-
)
|
|
137
|
-
for message in messages
|
|
138
|
-
]
|
|
139
|
-
responses = await asyncio.gather(*tasks)
|
|
140
|
-
|
|
141
|
-
for response in responses:
|
|
142
|
-
print(response.choices[0].message.content)
|
|
143
|
-
|
|
144
|
-
asyncio.run(async_chat_completion(messages))
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Completions
|
|
148
|
-
|
|
149
|
-
Completions are for code and language models shown [here](https://docs.together.ai/docs/inference-models). Below, a code model example is shown.
|
|
150
|
-
|
|
151
|
-
```python
|
|
152
|
-
import os
|
|
153
|
-
from together import Together
|
|
154
|
-
|
|
155
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
156
|
-
|
|
157
|
-
response = client.completions.create(
|
|
158
|
-
model="codellama/CodeLlama-34b-Python-hf",
|
|
159
|
-
prompt="Write a Next.js component with TailwindCSS for a header component.",
|
|
160
|
-
max_tokens=200,
|
|
161
|
-
)
|
|
162
|
-
print(response.choices[0].text)
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
#### Streaming
|
|
166
|
-
|
|
167
|
-
```python
|
|
168
|
-
import os
|
|
169
|
-
from together import Together
|
|
170
|
-
|
|
171
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
172
|
-
stream = client.completions.create(
|
|
173
|
-
model="codellama/CodeLlama-34b-Python-hf",
|
|
174
|
-
prompt="Write a Next.js component with TailwindCSS for a header component.",
|
|
175
|
-
stream=True,
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
for chunk in stream:
|
|
179
|
-
print(chunk.choices[0].delta.content or "", end="", flush=True)
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
#### Async usage
|
|
183
|
-
|
|
184
|
-
```python
|
|
185
|
-
import os, asyncio
|
|
186
|
-
from together import AsyncTogether
|
|
187
|
-
|
|
188
|
-
async_client = AsyncTogether(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
189
|
-
prompts = [
|
|
190
|
-
"Write a Next.js component with TailwindCSS for a header component.",
|
|
191
|
-
"Write a python function for the fibonacci sequence",
|
|
192
|
-
]
|
|
193
|
-
|
|
194
|
-
async def async_chat_completion(prompts):
|
|
195
|
-
async_client = AsyncTogether(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
196
|
-
tasks = [
|
|
197
|
-
async_client.completions.create(
|
|
198
|
-
model="codellama/CodeLlama-34b-Python-hf",
|
|
199
|
-
prompt=prompt,
|
|
200
|
-
)
|
|
201
|
-
for prompt in prompts
|
|
202
|
-
]
|
|
203
|
-
responses = await asyncio.gather(*tasks)
|
|
204
|
-
|
|
205
|
-
for response in responses:
|
|
206
|
-
print(response.choices[0].text)
|
|
207
|
-
|
|
208
|
-
asyncio.run(async_chat_completion(prompts))
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Image generation
|
|
212
|
-
|
|
213
|
-
```python
|
|
214
|
-
import os
|
|
215
|
-
from together import Together
|
|
216
|
-
|
|
217
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
218
|
-
|
|
219
|
-
response = client.images.generate(
|
|
220
|
-
prompt="space robots",
|
|
221
|
-
model="stabilityai/stable-diffusion-xl-base-1.0",
|
|
222
|
-
steps=10,
|
|
223
|
-
n=4,
|
|
224
|
-
)
|
|
225
|
-
print(response.data[0].b64_json)
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Embeddings
|
|
229
|
-
|
|
230
|
-
```python
|
|
231
|
-
from typing import List
|
|
232
|
-
from together import Together
|
|
233
|
-
|
|
234
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
235
|
-
|
|
236
|
-
def get_embeddings(texts: List[str], model: str) -> List[List[float]]:
|
|
237
|
-
texts = [text.replace("\n", " ") for text in texts]
|
|
238
|
-
outputs = client.embeddings.create(model=model, input = texts)
|
|
239
|
-
return [outputs.data[i].embedding for i in range(len(texts))]
|
|
240
|
-
|
|
241
|
-
input_texts = ['Our solar system orbits the Milky Way galaxy at about 515,000 mph']
|
|
242
|
-
embeddings = get_embeddings(input_texts, model='togethercomputer/m2-bert-80M-8k-retrieval')
|
|
243
|
-
|
|
244
|
-
print(embeddings)
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Files
|
|
248
|
-
|
|
249
|
-
The files API is used for fine-tuning and allows developers to upload data to fine-tune on. It also has several methods to list all files, retrive files, and delete files. Please refer to our fine-tuning docs [here](https://docs.together.ai/docs/fine-tuning-python).
|
|
250
|
-
|
|
251
|
-
```python
|
|
252
|
-
import os
|
|
253
|
-
from together import Together
|
|
254
|
-
|
|
255
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
256
|
-
|
|
257
|
-
client.files.upload(file="somedata.jsonl") # uploads a file
|
|
258
|
-
client.files.list() # lists all uploaded files
|
|
259
|
-
client.files.retrieve(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves a specific file
|
|
260
|
-
client.files.retrieve_content(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # retrieves content of a specific file
|
|
261
|
-
client.files.delete(id="file-d0d318cb-b7d9-493a-bd70-1cfe089d3815") # deletes a file
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Fine-tunes
|
|
265
|
-
|
|
266
|
-
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).
|
|
267
|
-
|
|
268
|
-
```python
|
|
269
|
-
import os
|
|
270
|
-
from together import Together
|
|
271
|
-
|
|
272
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
273
|
-
|
|
274
|
-
client.fine_tuning.create(
|
|
275
|
-
training_file = 'file-d0d318cb-b7d9-493a-bd70-1cfe089d3815',
|
|
276
|
-
model = 'mistralai/Mixtral-8x7B-Instruct-v0.1',
|
|
277
|
-
n_epochs = 3,
|
|
278
|
-
n_checkpoints = 1,
|
|
279
|
-
batch_size = 4,
|
|
280
|
-
learning_rate = 1e-5,
|
|
281
|
-
suffix = 'my-demo-finetune',
|
|
282
|
-
wandb_api_key = '1a2b3c4d5e.......',
|
|
283
|
-
)
|
|
284
|
-
client.fine_tuning.list() # lists all fine-tuned jobs
|
|
285
|
-
client.fine_tuning.retrieve(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # retrieves information on finetune event
|
|
286
|
-
client.fine_tuning.cancel(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # Cancels a fine-tuning job
|
|
287
|
-
client.fine_tuning.list_events(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # Lists events of a fine-tune job
|
|
288
|
-
client.fine_tuning.download(id="ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b") # downloads compressed fine-tuned model or checkpoint to local disk
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Models
|
|
292
|
-
|
|
293
|
-
This lists all the models that Together supports.
|
|
294
|
-
|
|
295
|
-
```python
|
|
296
|
-
import os
|
|
297
|
-
from together import Together
|
|
298
|
-
|
|
299
|
-
client = Together(api_key=os.environ.get("TOGETHER_API_KEY"))
|
|
300
|
-
|
|
301
|
-
models = client.models.list()
|
|
302
|
-
|
|
303
|
-
for model in models:
|
|
304
|
-
print(model)
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
## Usage – CLI
|
|
308
|
-
|
|
309
|
-
### Chat Completions
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
together chat.completions \
|
|
313
|
-
--message "system" "You are a helpful assistant named Together" \
|
|
314
|
-
--message "user" "What is your name?" \
|
|
315
|
-
--model mistralai/Mixtral-8x7B-Instruct-v0.1
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
|
|
319
|
-
|
|
320
|
-
### Completions
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
together completions \
|
|
324
|
-
"Large language models are " \
|
|
325
|
-
--model mistralai/Mixtral-8x7B-v0.1 \
|
|
326
|
-
--max-tokens 512 \
|
|
327
|
-
--stop "."
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
The Completions CLI enables streaming tokens to stdout by default. To disable streaming, use `--no-stream`.
|
|
331
|
-
|
|
332
|
-
### Image Generations
|
|
333
|
-
|
|
334
|
-
```bash
|
|
335
|
-
together images generate \
|
|
336
|
-
"space robots" \
|
|
337
|
-
--model stabilityai/stable-diffusion-xl-base-1.0 \
|
|
338
|
-
--n 4
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
The image is opened in the default image viewer by default. To disable this, use `--no-show`.
|
|
342
|
-
|
|
343
|
-
### Files
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
# Help
|
|
347
|
-
together files --help
|
|
348
|
-
|
|
349
|
-
# Check file
|
|
350
|
-
together files check example.jsonl
|
|
351
|
-
|
|
352
|
-
# Upload file
|
|
353
|
-
together files upload example.jsonl
|
|
354
|
-
|
|
355
|
-
# List files
|
|
356
|
-
together files list
|
|
357
|
-
|
|
358
|
-
# Retrieve file metadata
|
|
359
|
-
together files retrieve file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
|
360
|
-
|
|
361
|
-
# Retrieve file content
|
|
362
|
-
together files retrieve-content file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
|
363
|
-
|
|
364
|
-
# Delete remote file
|
|
365
|
-
together files delete file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### Fine-tuning
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
# Help
|
|
372
|
-
together fine-tuning --help
|
|
373
|
-
|
|
374
|
-
# Create fine-tune job
|
|
375
|
-
together fine-tuning create \
|
|
376
|
-
--model togethercomputer/llama-2-7b-chat \
|
|
377
|
-
--training-file file-711d8724-b3e3-4ae2-b516-94841958117d
|
|
378
|
-
|
|
379
|
-
# List fine-tune jobs
|
|
380
|
-
together fine-tuning list
|
|
381
|
-
|
|
382
|
-
# Retrieve fine-tune job details
|
|
383
|
-
together fine-tuning retrieve ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
|
384
|
-
|
|
385
|
-
# List fine-tune job events
|
|
386
|
-
together fine-tuning list-events ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
|
387
|
-
|
|
388
|
-
# Cancel running job
|
|
389
|
-
together fine-tuning cancel ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
|
390
|
-
|
|
391
|
-
# Download fine-tuned model weights
|
|
392
|
-
together fine-tuning download ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Models
|
|
396
|
-
|
|
397
|
-
```bash
|
|
398
|
-
# Help
|
|
399
|
-
together models --help
|
|
400
|
-
|
|
401
|
-
# List models
|
|
402
|
-
together models list
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
## Contributing
|
|
406
|
-
|
|
407
|
-
Refer to the [Contributing Guide](CONTRIBUTING.md)
|
|
408
|
-
|
together-1.2.11.dist-info/RECORD
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
together/__init__.py,sha256=B8T7ybZ7D6jJNRTuFDVjOFlImCNag8tNZXpZdXz7xNM,1530
|
|
2
|
-
together/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
together/abstract/api_requestor.py,sha256=HxVOcaGBLHzNEDBxYx7XZ2OGBBt1z_wMBSnsIcnS6vA,25570
|
|
4
|
-
together/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
together/cli/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
together/cli/api/chat.py,sha256=2PHRb-9T-lUEKhUJFtc7SxJv3shCVx40gq_8pzfsewM,9234
|
|
7
|
-
together/cli/api/completions.py,sha256=l-Zw5t7hojL3w8xd_mitS2NRB72i5Z0xwkzH0rT5XMc,4263
|
|
8
|
-
together/cli/api/files.py,sha256=QLYEXRkY8J2Gg1SbTCtzGfoTMvosoeACNK83L_oLubs,3397
|
|
9
|
-
together/cli/api/finetune.py,sha256=c6-T-5K7sODgQa7ehdqZqyluRaDUzPXCgMeFWm3iIwA,8855
|
|
10
|
-
together/cli/api/images.py,sha256=01dFYa2sK1HqUwVCD9FlwcjqkYWLoNxFZkzok13EriE,2363
|
|
11
|
-
together/cli/api/models.py,sha256=xWEzu8ZpxM_Pz9KEjRPRVuv_v22RayYZ4QcgiezT5tE,1126
|
|
12
|
-
together/cli/cli.py,sha256=RC0tgapkSOFjsRPg8p-8dx9D2LDzm8YmVCHUjk_aVyQ,1977
|
|
13
|
-
together/client.py,sha256=mOlIFjjE9eSTb0o_weaKJwm8qvWNKHDiMmp8kQ7y68I,4946
|
|
14
|
-
together/constants.py,sha256=WHe6JA9TliwgErkCnovWPS9w9xXfA3X5PtKJv_y2JxQ,908
|
|
15
|
-
together/error.py,sha256=emjhTSsLwiZvW0v1EmYemjacCMtcFIKAXWWK_2IdP18,5419
|
|
16
|
-
together/filemanager.py,sha256=QHhBn73oVFdgUpSYXYLmJzHJ9c5wYEMJC0ur6ZgDeYo,11269
|
|
17
|
-
together/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
together/legacy/base.py,sha256=ehrX1SCfRbK5OA83wL1q7-tfF-yuZOUxzjxYfFtdvvQ,727
|
|
19
|
-
together/legacy/complete.py,sha256=NRJX-vjnkg4HrgDo9LS3jFfhwfXpeGxcl24dcrLPK3A,2439
|
|
20
|
-
together/legacy/embeddings.py,sha256=nyTERjyPLTm7Sc987a9FJt1adnW7gIa7xs2CwXLE9EI,635
|
|
21
|
-
together/legacy/files.py,sha256=qmAqMiNTPWb6WvLV5Tsv6kxGRfQ31q7OkHZNFwkw8v0,4082
|
|
22
|
-
together/legacy/finetune.py,sha256=k-lERbZLEZlW1QQ9A9zhhwl5KIPjf_jT0R0LSiLbD2Y,5063
|
|
23
|
-
together/legacy/images.py,sha256=bJJRs-6C7-NexPyaeyHiYlHOU51yls5-QAiqtO4xrZU,626
|
|
24
|
-
together/legacy/models.py,sha256=85ZN9Ids_FjdYNDRv5k7sgrtVWPKPHqkDplORtVUGHg,1087
|
|
25
|
-
together/resources/__init__.py,sha256=7BLdBCNUbgi5mz30EFfdkdIYiGfFCkiUbdNzMY1-igY,792
|
|
26
|
-
together/resources/chat/__init__.py,sha256=RsTptdP8MeGjcdIjze896-J27cRvCbUoMft0X2BVlQ8,617
|
|
27
|
-
together/resources/chat/completions.py,sha256=AOmm2CRwhz9VZpez35LoOUw432IPbtwCeUQXtCd3RK8,14208
|
|
28
|
-
together/resources/completions.py,sha256=C_Djn41zjdWdPn4rnOrAVEHvOaqyBSyxZS4eYqsZdMI,11482
|
|
29
|
-
together/resources/embeddings.py,sha256=PTvLb82yjG_-iQOyuhsilp77Fr7gZ0o6WD2KeRnKoxs,2675
|
|
30
|
-
together/resources/files.py,sha256=bnPbaF25e4InBRPvHwXHXT-oSX1Z1sZRsnQW5wq82U4,4990
|
|
31
|
-
together/resources/finetune.py,sha256=t8wOulAyNFKlHjHv_u4-PwdL-rR-klgEvDEfH-efdkQ,15970
|
|
32
|
-
together/resources/images.py,sha256=LQUjKPaFxWTqOAPnyF1Pp7Rz4NLOYhmoKwshpYiprEM,4923
|
|
33
|
-
together/resources/models.py,sha256=2dtHhXAqTDOOpwSbYLzWcKTC0-m2Szlb7LDYvp7Jr4w,1786
|
|
34
|
-
together/resources/rerank.py,sha256=3Ju_aRSyZ1s_3zCSNZnSnEJErUVmt2xa3M8z1nvejMA,3931
|
|
35
|
-
together/together_response.py,sha256=MhczUCPem93cjX-A1TOAUrRj3sO-o3SLcEcTsZgVzQI,1319
|
|
36
|
-
together/types/__init__.py,sha256=ghMiyyR2UzY-Io9Ck3ocwmS6_XSO9VaYWwbLqPDSZfo,1681
|
|
37
|
-
together/types/abstract.py,sha256=1lFQI_3WjsR_t1128AeKW0aTk6EiM6Gh1J3ZuyLLPao,642
|
|
38
|
-
together/types/chat_completions.py,sha256=wy_2E2moA2Aw1RVRXG7bLcHqkSULv-MlJZygajbQN_8,4406
|
|
39
|
-
together/types/common.py,sha256=4ZeIgqGioqhIC-nNxY90czNPp-kAqboMulw6-1z6ShM,1511
|
|
40
|
-
together/types/completions.py,sha256=yydloTQePGaY97Lx-kbkvgCqBFhHFl7jU5s7uf9Ncg0,2901
|
|
41
|
-
together/types/embeddings.py,sha256=J7grkYYn7xhqeKaBO2T-8XQRtHhkzYzymovtGdIUK5A,751
|
|
42
|
-
together/types/error.py,sha256=OVlCs3cx_2WhZK4JzHT8SQyRIIqKOP1AZQ4y1PydjAE,370
|
|
43
|
-
together/types/files.py,sha256=-rEUfsV6f2vZB9NrFxT4_933ubsDIUNkPB-3OlOFk4A,1954
|
|
44
|
-
together/types/finetune.py,sha256=UqZH98L3vVxZ6vykE5rmZFdpYQrqrkTvotZIiyqAME0,7362
|
|
45
|
-
together/types/images.py,sha256=zX4Vt38tFDKU6yGb_hBY_N5eSTn3KPdpP5Ce_qnRHXQ,915
|
|
46
|
-
together/types/models.py,sha256=K9Om3cCFexy7qzRSEXUj7gpCy1CVb1hHx7MGG-hvTLw,1035
|
|
47
|
-
together/types/rerank.py,sha256=qZfuXOn7MZ6ly8hpJ_MZ7OU_Bi1-cgYNSB20Wja8Qkk,1061
|
|
48
|
-
together/utils/__init__.py,sha256=VpjeRTya1m5eEE-Qe1zYTFsNAvuEA-dy7M2eG9Xu4fc,662
|
|
49
|
-
together/utils/_log.py,sha256=yzdOV6iBEsyqF8UVvKhZm-ATtRokm34V-dXjTv3WKdE,1665
|
|
50
|
-
together/utils/api_helpers.py,sha256=RSF7SRhbjHzroMOSWAXscflByM1r1ta_1SpxkAT22iE,2407
|
|
51
|
-
together/utils/files.py,sha256=gMLthqfP5hKxVAerHMdy7gLXzdfY6lyOXdpW24Y4X3I,7165
|
|
52
|
-
together/utils/tools.py,sha256=3-lXWP3cBCzOVSZg9tr5zOT1jaVeKAKVWxO2fcXZTh8,1788
|
|
53
|
-
together/version.py,sha256=p03ivHyE0SyWU4jAnRTBi_sOwywVWoZPU4g2gzRgG-Y,126
|
|
54
|
-
together-1.2.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
55
|
-
together-1.2.11.dist-info/METADATA,sha256=dGhkUfJY1_UbjfOmWiFoDIs-QzLFD1ZgBwRy9E7P59Y,11813
|
|
56
|
-
together-1.2.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
57
|
-
together-1.2.11.dist-info/entry_points.txt,sha256=G-b5NKW6lUUf1V1fH8IPTBb7jXnK7lhbX9H1zTEJXPs,50
|
|
58
|
-
together-1.2.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|