together 2.0.0a15__tar.gz → 2.0.0a17__tar.gz

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.
Files changed (326) hide show
  1. together-2.0.0a17/.release-please-manifest.json +3 -0
  2. {together-2.0.0a15 → together-2.0.0a17}/CHANGELOG.md +34 -0
  3. {together-2.0.0a15 → together-2.0.0a17}/PKG-INFO +4 -2
  4. {together-2.0.0a15 → together-2.0.0a17}/README.md +0 -1
  5. {together-2.0.0a15 → together-2.0.0a17}/api.md +4 -11
  6. together-2.0.0a17/examples/tokenize_data.py +259 -0
  7. {together-2.0.0a15 → together-2.0.0a17}/pyproject.toml +13 -10
  8. {together-2.0.0a15 → together-2.0.0a17}/src/together/_base_client.py +134 -11
  9. {together-2.0.0a15 → together-2.0.0a17}/src/together/_client.py +7 -0
  10. {together-2.0.0a15 → together-2.0.0a17}/src/together/_models.py +16 -1
  11. {together-2.0.0a15 → together-2.0.0a17}/src/together/_types.py +9 -0
  12. {together-2.0.0a15 → together-2.0.0a17}/src/together/_version.py +1 -1
  13. {together-2.0.0a15 → together-2.0.0a17}/src/together/constants.py +1 -1
  14. {together-2.0.0a15 → together-2.0.0a17}/src/together/error.py +1 -2
  15. together-2.0.0a17/src/together/lib/_google_colab.py +39 -0
  16. together-2.0.0a15/src/together/lib/cli/cli.py → together-2.0.0a17/src/together/lib/cli/__init__.py +1 -1
  17. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/__init__.py +47 -0
  18. together-2.0.0a15/src/together/lib/cli/api/beta/clusters.py → together-2.0.0a17/src/together/lib/cli/api/beta/clusters/create.py +5 -179
  19. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/delete.py +35 -0
  20. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/get_credentials.py +151 -0
  21. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/list.py +24 -0
  22. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/list_regions.py +37 -0
  23. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/retrieve.py +31 -0
  24. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/__init__.py +19 -0
  25. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/create.py +49 -0
  26. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/delete.py +38 -0
  27. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/list.py +42 -0
  28. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/retrieve.py +34 -0
  29. together-2.0.0a17/src/together/lib/cli/api/beta/clusters/update.py +54 -0
  30. together-2.0.0a17/src/together/lib/cli/api/endpoints/__init__.py +56 -0
  31. together-2.0.0a17/src/together/lib/cli/api/endpoints/availability_zones.py +26 -0
  32. together-2.0.0a17/src/together/lib/cli/api/endpoints/create.py +161 -0
  33. together-2.0.0a17/src/together/lib/cli/api/endpoints/delete.py +15 -0
  34. together-2.0.0a17/src/together/lib/cli/api/endpoints/hardware.py +40 -0
  35. together-2.0.0a17/src/together/lib/cli/api/endpoints/list.py +66 -0
  36. together-2.0.0a17/src/together/lib/cli/api/endpoints/retrieve.py +23 -0
  37. together-2.0.0a17/src/together/lib/cli/api/endpoints/start.py +25 -0
  38. together-2.0.0a17/src/together/lib/cli/api/endpoints/stop.py +25 -0
  39. together-2.0.0a17/src/together/lib/cli/api/endpoints/update.py +77 -0
  40. together-2.0.0a17/src/together/lib/cli/api/evals/__init__.py +19 -0
  41. together-2.0.0a15/src/together/lib/cli/api/evals.py → together-2.0.0a17/src/together/lib/cli/api/evals/create.py +6 -129
  42. together-2.0.0a17/src/together/lib/cli/api/evals/list.py +58 -0
  43. together-2.0.0a17/src/together/lib/cli/api/evals/retrieve.py +21 -0
  44. together-2.0.0a17/src/together/lib/cli/api/evals/status.py +20 -0
  45. together-2.0.0a17/src/together/lib/cli/api/files/__init__.py +23 -0
  46. together-2.0.0a17/src/together/lib/cli/api/files/check.py +21 -0
  47. together-2.0.0a17/src/together/lib/cli/api/files/delete.py +20 -0
  48. together-2.0.0a17/src/together/lib/cli/api/files/list.py +34 -0
  49. together-2.0.0a17/src/together/lib/cli/api/files/retrieve.py +20 -0
  50. together-2.0.0a17/src/together/lib/cli/api/files/retrieve_content.py +25 -0
  51. together-2.0.0a17/src/together/lib/cli/api/files/upload.py +38 -0
  52. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/__init__.py +27 -0
  53. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/cancel.py +28 -0
  54. together-2.0.0a15/src/together/lib/cli/api/fine_tuning.py → together-2.0.0a17/src/together/lib/cli/api/fine_tuning/create.py +5 -257
  55. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/delete.py +29 -0
  56. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/download.py +94 -0
  57. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list.py +44 -0
  58. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list_checkpoints.py +42 -0
  59. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list_events.py +35 -0
  60. together-2.0.0a17/src/together/lib/cli/api/fine_tuning/retrieve.py +27 -0
  61. together-2.0.0a17/src/together/lib/cli/api/models/__init__.py +15 -0
  62. together-2.0.0a17/src/together/lib/cli/api/models/list.py +55 -0
  63. together-2.0.0a15/src/together/lib/cli/api/models.py → together-2.0.0a17/src/together/lib/cli/api/models/upload.py +4 -51
  64. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/clusters.py +36 -28
  65. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/storage.py +30 -21
  66. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/endpoints.py +2 -2
  67. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/__init__.py +4 -3
  68. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/__init__.py +0 -2
  69. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_create_params.py +3 -3
  70. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/__init__.py +0 -1
  71. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/cluster_storage.py +4 -0
  72. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat_completions.py +1 -1
  73. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_create_params.py +1 -1
  74. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoints.py +1 -1
  75. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/clusters/test_storage.py +6 -7
  76. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/test_clusters.py +18 -26
  77. {together-2.0.0a15 → together-2.0.0a17}/tests/test_cli_utils.py +2 -2
  78. {together-2.0.0a15 → together-2.0.0a17}/tests/test_client.py +185 -2
  79. {together-2.0.0a15 → together-2.0.0a17}/uv.lock +90 -2
  80. together-2.0.0a15/.release-please-manifest.json +0 -3
  81. together-2.0.0a15/src/together/lib/cli/api/beta/clusters_storage.py +0 -152
  82. together-2.0.0a15/src/together/lib/cli/api/endpoints.py +0 -467
  83. together-2.0.0a15/src/together/lib/cli/api/files.py +0 -133
  84. together-2.0.0a15/src/together/types/beta/cluster_create_response.py +0 -9
  85. together-2.0.0a15/src/together/types/beta/cluster_update_response.py +0 -9
  86. together-2.0.0a15/src/together/types/beta/clusters/storage_create_response.py +0 -9
  87. together-2.0.0a15/tests/integration/__init__.py +0 -0
  88. together-2.0.0a15/tests/integration/resources/__init__.py +0 -0
  89. {together-2.0.0a15 → together-2.0.0a17}/.gitignore +0 -0
  90. {together-2.0.0a15 → together-2.0.0a17}/CONTRIBUTING.md +0 -0
  91. {together-2.0.0a15 → together-2.0.0a17}/LICENSE +0 -0
  92. {together-2.0.0a15 → together-2.0.0a17}/SECURITY.md +0 -0
  93. {together-2.0.0a15 → together-2.0.0a17}/bin/check-release-environment +0 -0
  94. {together-2.0.0a15 → together-2.0.0a17}/bin/publish-pypi +0 -0
  95. {together-2.0.0a15 → together-2.0.0a17}/examples/.keep +0 -0
  96. {together-2.0.0a15 → together-2.0.0a17}/examples/coqa-small.jsonl +0 -0
  97. {together-2.0.0a15 → together-2.0.0a17}/examples/coqa.jsonl +0 -0
  98. {together-2.0.0a15 → together-2.0.0a17}/examples/embedding.py +0 -0
  99. {together-2.0.0a15 → together-2.0.0a17}/examples/file-upload.py +0 -0
  100. {together-2.0.0a15 → together-2.0.0a17}/examples/files.py +0 -0
  101. {together-2.0.0a15 → together-2.0.0a17}/examples/fine_tuning.py +0 -0
  102. {together-2.0.0a15 → together-2.0.0a17}/examples/image.py +0 -0
  103. {together-2.0.0a15 → together-2.0.0a17}/examples/models.py +0 -0
  104. {together-2.0.0a15 → together-2.0.0a17}/examples/streaming.py +0 -0
  105. {together-2.0.0a15 → together-2.0.0a17}/release-please-config.json +0 -0
  106. {together-2.0.0a15 → together-2.0.0a17}/requirements-dev.lock +0 -0
  107. {together-2.0.0a15 → together-2.0.0a17}/src/together/__init__.py +0 -0
  108. {together-2.0.0a15 → together-2.0.0a17}/src/together/_compat.py +0 -0
  109. {together-2.0.0a15 → together-2.0.0a17}/src/together/_constants.py +0 -0
  110. {together-2.0.0a15 → together-2.0.0a17}/src/together/_exceptions.py +0 -0
  111. {together-2.0.0a15 → together-2.0.0a17}/src/together/_files.py +0 -0
  112. {together-2.0.0a15 → together-2.0.0a17}/src/together/_qs.py +0 -0
  113. {together-2.0.0a15 → together-2.0.0a17}/src/together/_resource.py +0 -0
  114. {together-2.0.0a15 → together-2.0.0a17}/src/together/_response.py +0 -0
  115. {together-2.0.0a15 → together-2.0.0a17}/src/together/_streaming.py +0 -0
  116. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/__init__.py +0 -0
  117. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_compat.py +0 -0
  118. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_datetime_parse.py +0 -0
  119. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_logs.py +0 -0
  120. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_proxy.py +0 -0
  121. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_reflection.py +0 -0
  122. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_resources_proxy.py +0 -0
  123. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_streams.py +0 -0
  124. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_sync.py +0 -0
  125. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_transform.py +0 -0
  126. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_typing.py +0 -0
  127. {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_utils.py +0 -0
  128. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/.keep +0 -0
  129. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/__init__.py +0 -0
  130. /together-2.0.0a15/src/together/lib/cli/api/utils.py → /together-2.0.0a17/src/together/lib/cli/api/_utils.py +0 -0
  131. /together-2.0.0a15/src/together/lib/cli/api/beta/beta.py → /together-2.0.0a17/src/together/lib/cli/api/beta/__init__.py +0 -0
  132. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/constants.py +0 -0
  133. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/__init__.py +0 -0
  134. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/files.py +0 -0
  135. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/fine_tuning.py +0 -0
  136. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/__init__.py +0 -0
  137. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/error.py +0 -0
  138. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/fine_tuning.py +0 -0
  139. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/__init__.py +0 -0
  140. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/_log.py +0 -0
  141. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/files.py +0 -0
  142. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/serializer.py +0 -0
  143. {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/tools.py +0 -0
  144. {together-2.0.0a15 → together-2.0.0a17}/src/together/py.typed +0 -0
  145. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/__init__.py +0 -0
  146. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/__init__.py +0 -0
  147. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/audio.py +0 -0
  148. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/speech.py +0 -0
  149. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/transcriptions.py +0 -0
  150. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/translations.py +0 -0
  151. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/voices.py +0 -0
  152. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/batches.py +0 -0
  153. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/__init__.py +0 -0
  154. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/beta.py +0 -0
  155. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/__init__.py +0 -0
  156. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/__init__.py +0 -0
  157. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/chat.py +0 -0
  158. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/completions.py +0 -0
  159. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/__init__.py +0 -0
  160. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/code_interpreter.py +0 -0
  161. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/sessions.py +0 -0
  162. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/completions.py +0 -0
  163. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/embeddings.py +0 -0
  164. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/evals.py +0 -0
  165. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/files.py +0 -0
  166. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/fine_tuning.py +0 -0
  167. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/hardware.py +0 -0
  168. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/images.py +0 -0
  169. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/jobs.py +0 -0
  170. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/models.py +0 -0
  171. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/rerank.py +0 -0
  172. {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/videos.py +0 -0
  173. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/__init__.py +0 -0
  174. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/speech_create_params.py +0 -0
  175. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/transcription_create_params.py +0 -0
  176. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/transcription_create_response.py +0 -0
  177. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/translation_create_params.py +0 -0
  178. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/translation_create_response.py +0 -0
  179. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/voice_list_response.py +0 -0
  180. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio_speech_stream_chunk.py +0 -0
  181. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/autoscaling.py +0 -0
  182. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/autoscaling_param.py +0 -0
  183. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_create_params.py +0 -0
  184. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_create_response.py +0 -0
  185. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_job.py +0 -0
  186. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_list_response.py +0 -0
  187. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster.py +0 -0
  188. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_delete_response.py +0 -0
  189. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_list_regions_response.py +0 -0
  190. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_list_response.py +0 -0
  191. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_update_params.py +0 -0
  192. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_create_params.py +0 -0
  193. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_delete_response.py +0 -0
  194. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_list_response.py +0 -0
  195. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_update_params.py +0 -0
  196. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/__init__.py +0 -0
  197. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion.py +0 -0
  198. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_chunk.py +0 -0
  199. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_image_url_param.py +0 -0
  200. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_text_param.py +0 -0
  201. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_video_url_param.py +0 -0
  202. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_usage.py +0 -0
  203. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_warning.py +0 -0
  204. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/completion_create_params.py +0 -0
  205. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter/__init__.py +0 -0
  206. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter/session_list_response.py +0 -0
  207. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter_execute_params.py +0 -0
  208. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion.py +0 -0
  209. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion_chunk.py +0 -0
  210. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion_create_params.py +0 -0
  211. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/dedicated_endpoint.py +0 -0
  212. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/embedding.py +0 -0
  213. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/embedding_create_params.py +0 -0
  214. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_avzones_response.py +0 -0
  215. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_params.py +0 -0
  216. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_response.py +0 -0
  217. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_update_params.py +0 -0
  218. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_create_params.py +0 -0
  219. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_create_response.py +0 -0
  220. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_list_params.py +0 -0
  221. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_list_response.py +0 -0
  222. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_status_response.py +0 -0
  223. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/evaluation_job.py +0 -0
  224. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/execute_response.py +0 -0
  225. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_delete_response.py +0 -0
  226. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_list.py +0 -0
  227. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_purpose.py +0 -0
  228. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_response.py +0 -0
  229. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_type.py +0 -0
  230. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/files.py +0 -0
  231. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_cancel_response.py +0 -0
  232. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_content_params.py +0 -0
  233. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_delete_params.py +0 -0
  234. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_delete_response.py +0 -0
  235. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_estimate_price_params.py +0 -0
  236. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_estimate_price_response.py +0 -0
  237. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_checkpoints_response.py +0 -0
  238. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_events_response.py +0 -0
  239. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_response.py +0 -0
  240. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune.py +0 -0
  241. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_event.py +0 -0
  242. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_event_type.py +0 -0
  243. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_response.py +0 -0
  244. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/hardware_list_params.py +0 -0
  245. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/hardware_list_response.py +0 -0
  246. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_data_b64.py +0 -0
  247. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_data_url.py +0 -0
  248. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_file.py +0 -0
  249. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_generate_params.py +0 -0
  250. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/job_list_response.py +0 -0
  251. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/job_retrieve_response.py +0 -0
  252. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/log_probs.py +0 -0
  253. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_list_params.py +0 -0
  254. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_list_response.py +0 -0
  255. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_object.py +0 -0
  256. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_upload_params.py +0 -0
  257. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_upload_response.py +0 -0
  258. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/models.py +0 -0
  259. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/rerank_create_params.py +0 -0
  260. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/rerank_create_response.py +0 -0
  261. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tool_choice.py +0 -0
  262. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tool_choice_param.py +0 -0
  263. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tools_param.py +0 -0
  264. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/training_method_dpo.py +0 -0
  265. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/training_method_sft.py +0 -0
  266. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/video_create_params.py +0 -0
  267. {together-2.0.0a15 → together-2.0.0a17}/src/together/types/video_job.py +0 -0
  268. {together-2.0.0a15 → together-2.0.0a17}/tests/__init__.py +0 -0
  269. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/__init__.py +0 -0
  270. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/__init__.py +0 -0
  271. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_speech.py +0 -0
  272. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_transcriptions.py +0 -0
  273. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_translations.py +0 -0
  274. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_voices.py +0 -0
  275. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/__init__.py +0 -0
  276. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/clusters/__init__.py +0 -0
  277. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/chat/__init__.py +0 -0
  278. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/chat/test_completions.py +0 -0
  279. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/code_interpreter/__init__.py +0 -0
  280. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/code_interpreter/test_sessions.py +0 -0
  281. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_batches.py +0 -0
  282. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_code_interpreter.py +0 -0
  283. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_completions.py +0 -0
  284. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_embeddings.py +0 -0
  285. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_endpoints.py +0 -0
  286. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_evals.py +0 -0
  287. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_files.py +0 -0
  288. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_fine_tuning.py +0 -0
  289. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_hardware.py +0 -0
  290. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_images.py +0 -0
  291. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_jobs.py +0 -0
  292. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_models.py +0 -0
  293. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_rerank.py +0 -0
  294. {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_videos.py +0 -0
  295. {together-2.0.0a15 → together-2.0.0a17}/tests/conftest.py +0 -0
  296. {together-2.0.0a15/src/together/lib/cli → together-2.0.0a17/tests/integration}/__init__.py +0 -0
  297. {together-2.0.0a15 → together-2.0.0a17}/tests/integration/constants.py +0 -0
  298. {together-2.0.0a15/src/together/lib/cli/api → together-2.0.0a17/tests/integration/resources}/__init__.py +0 -0
  299. {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/generate_hyperparameters.py +0 -0
  300. {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_completion.py +0 -0
  301. {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_completion_stream.py +0 -0
  302. {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_files.py +0 -0
  303. {together-2.0.0a15 → together-2.0.0a17}/tests/sample_file.txt +0 -0
  304. {together-2.0.0a15 → together-2.0.0a17}/tests/test_deepcopy.py +0 -0
  305. {together-2.0.0a15 → together-2.0.0a17}/tests/test_extract_files.py +0 -0
  306. {together-2.0.0a15 → together-2.0.0a17}/tests/test_files.py +0 -0
  307. {together-2.0.0a15 → together-2.0.0a17}/tests/test_models.py +0 -0
  308. {together-2.0.0a15 → together-2.0.0a17}/tests/test_qs.py +0 -0
  309. {together-2.0.0a15 → together-2.0.0a17}/tests/test_required_args.py +0 -0
  310. {together-2.0.0a15 → together-2.0.0a17}/tests/test_response.py +0 -0
  311. {together-2.0.0a15 → together-2.0.0a17}/tests/test_streaming.py +0 -0
  312. {together-2.0.0a15 → together-2.0.0a17}/tests/test_transform.py +0 -0
  313. {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_datetime_parse.py +0 -0
  314. {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_proxy.py +0 -0
  315. {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_typing.py +0 -0
  316. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_async_client.py +0 -0
  317. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_client.py +0 -0
  318. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_code_interpreter.py +0 -0
  319. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_files_checks.py +0 -0
  320. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_files_resource.py +0 -0
  321. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_fine_tuning_resources.py +0 -0
  322. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_imports.py +0 -0
  323. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_multipart_upload_manager.py +0 -0
  324. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_preference_openai.py +0 -0
  325. {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_video_url.py +0 -0
  326. {together-2.0.0a15 → together-2.0.0a17}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "2.0.0-alpha.17"
3
+ }
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-alpha.17 (2026-01-21)
4
+
5
+ Full Changelog: [v2.0.0-alpha.16...v2.0.0-alpha.17](https://github.com/togethercomputer/together-py/compare/v2.0.0-alpha.16...v2.0.0-alpha.17)
6
+
7
+ ### Features
8
+
9
+ * **cli:** add b200 and h200 GPU options for endpoint creation ([#218](https://github.com/togethercomputer/together-py/issues/218)) ([b514912](https://github.com/togethercomputer/together-py/commit/b514912a281922fefbf8a9f62b936ed1de243718))
10
+ * Improve usage of models list cli command ([#216](https://github.com/togethercomputer/together-py/issues/216)) ([430e6c1](https://github.com/togethercomputer/together-py/commit/430e6c1e030749be474f020b677d91014ba4482c))
11
+
12
+
13
+ ### Chores
14
+
15
+ * Deprecate CLI usage for endpoints create flag --no-promopt-cache ([#219](https://github.com/togethercomputer/together-py/issues/219)) ([55e9700](https://github.com/togethercomputer/together-py/commit/55e9700187b42f8baff6f567a3a657b46577ed88))
16
+ * Mark disable_prompt_cache as deprecated for endpoint creation ([6a629b2](https://github.com/togethercomputer/together-py/commit/6a629b29e53b4374503d30ca75456184ef313b67))
17
+
18
+ ## 2.0.0-alpha.16 (2026-01-18)
19
+
20
+ Full Changelog: [v2.0.0-alpha.15...v2.0.0-alpha.16](https://github.com/togethercomputer/together-py/compare/v2.0.0-alpha.15...v2.0.0-alpha.16)
21
+
22
+ ### Features
23
+
24
+ * Add backwards compatible support for google colab api keys ([#211](https://github.com/togethercomputer/together-py/issues/211)) ([80dacca](https://github.com/togethercomputer/together-py/commit/80daccafb4ef69438be1d98773fe3a31ac09cace))
25
+ * Add together clusters get-credentials CLI command ([#208](https://github.com/togethercomputer/together-py/issues/208)) ([fa54aa9](https://github.com/togethercomputer/together-py/commit/fa54aa9646e9dab2822491473856f64d5cf4688f))
26
+ * **client:** add support for binary request streaming ([8464e12](https://github.com/togethercomputer/together-py/commit/8464e12187b42ff3a58c82ca55ec284ffa98aeea))
27
+
28
+
29
+ ### Chores
30
+
31
+ * Add code samples and descriptions to instant cluster apis ([e1ad614](https://github.com/togethercomputer/together-py/commit/e1ad614f8c3189ddc991fab96013cf5f7aace1d8))
32
+ * Improve example script ([#213](https://github.com/togethercomputer/together-py/issues/213)) ([7839058](https://github.com/togethercomputer/together-py/commit/783905873500e3228837e2cf87ebc097d9026539))
33
+ * **internal:** update `actions/checkout` version ([dc0819c](https://github.com/togethercomputer/together-py/commit/dc0819c95429f69bf0d7ef442b7b1ea811ec40b5))
34
+ * Port tokenize_data example ([#209](https://github.com/togethercomputer/together-py/issues/209)) ([f2714a8](https://github.com/togethercomputer/together-py/commit/f2714a84f2802989a8f519c21e5c62e9fc787038))
35
+ * Update cluster apis to reflect their new response shape ([6be132b](https://github.com/togethercomputer/together-py/commit/6be132b210973e9c26beedd0080039e28e522096))
36
+
3
37
  ## 2.0.0-alpha.15 (2026-01-09)
4
38
 
5
39
  Full Changelog: [v2.0.0-alpha.14...v2.0.0-alpha.15](https://github.com/togethercomputer/together-py/compare/v2.0.0-alpha.14...v2.0.0-alpha.15)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: together
3
- Version: 2.0.0a15
3
+ Version: 2.0.0a17
4
4
  Summary: The official Python library for the together API
5
5
  Project-URL: Homepage, https://github.com/togethercomputer/together-py
6
6
  Project-URL: Repository, https://github.com/togethercomputer/together-py
@@ -33,12 +33,15 @@ Requires-Dist: rich>=13.7.1
33
33
  Requires-Dist: sniffio
34
34
  Requires-Dist: tabulate>=0.9.0
35
35
  Requires-Dist: tqdm>=4.67.1
36
+ Requires-Dist: types-pyyaml>=6.0.12.20250915
36
37
  Requires-Dist: types-tabulate>=0.9.0.20240106
37
38
  Requires-Dist: types-tqdm>=4.67.0.20250516
38
39
  Requires-Dist: typing-extensions<5,>=4.10
39
40
  Provides-Extra: aiohttp
40
41
  Requires-Dist: aiohttp; extra == 'aiohttp'
41
42
  Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
43
+ Provides-Extra: cli
44
+ Requires-Dist: pyyaml; extra == 'cli'
42
45
  Provides-Extra: pyarrow
43
46
  Requires-Dist: pyarrow-stubs>=10.0.1.7; extra == 'pyarrow'
44
47
  Requires-Dist: pyarrow>=16.1.0; extra == 'pyarrow'
@@ -236,7 +239,6 @@ cluster = client.beta.clusters.create(
236
239
  billing_type="RESERVED",
237
240
  cluster_name="cluster_name",
238
241
  driver_version="CUDA_12_5_555",
239
- duration_days=0,
240
242
  gpu_type="H100_SXM",
241
243
  num_gpus=0,
242
244
  region="us-central-8",
@@ -190,7 +190,6 @@ cluster = client.beta.clusters.create(
190
190
  billing_type="RESERVED",
191
191
  cluster_name="cluster_name",
192
192
  driver_version="CUDA_12_5_555",
193
- duration_days=0,
194
193
  gpu_type="H100_SXM",
195
194
  num_gpus=0,
196
195
  region="us-central-8",
@@ -7,8 +7,6 @@ Types:
7
7
  ```python
8
8
  from together.types.beta import (
9
9
  Cluster,
10
- ClusterCreateResponse,
11
- ClusterUpdateResponse,
12
10
  ClusterListResponse,
13
11
  ClusterDeleteResponse,
14
12
  ClusterListRegionsResponse,
@@ -17,9 +15,9 @@ from together.types.beta import (
17
15
 
18
16
  Methods:
19
17
 
20
- - <code title="post /clusters">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">create</a>(\*\*<a href="src/together/types/beta/cluster_create_params.py">params</a>) -> <a href="./src/together/types/beta/cluster_create_response.py">ClusterCreateResponse</a></code>
18
+ - <code title="post /clusters">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">create</a>(\*\*<a href="src/together/types/beta/cluster_create_params.py">params</a>) -> <a href="./src/together/types/beta/cluster.py">Cluster</a></code>
21
19
  - <code title="get /clusters/{cluster_id}">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">retrieve</a>(cluster_id) -> <a href="./src/together/types/beta/cluster.py">Cluster</a></code>
22
- - <code title="put /clusters/{cluster_id}">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">update</a>(cluster_id, \*\*<a href="src/together/types/beta/cluster_update_params.py">params</a>) -> <a href="./src/together/types/beta/cluster_update_response.py">ClusterUpdateResponse</a></code>
20
+ - <code title="put /clusters/{cluster_id}">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">update</a>(cluster_id, \*\*<a href="src/together/types/beta/cluster_update_params.py">params</a>) -> <a href="./src/together/types/beta/cluster.py">Cluster</a></code>
23
21
  - <code title="get /clusters">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">list</a>() -> <a href="./src/together/types/beta/cluster_list_response.py">ClusterListResponse</a></code>
24
22
  - <code title="delete /clusters/{cluster_id}">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">delete</a>(cluster_id) -> <a href="./src/together/types/beta/cluster_delete_response.py">ClusterDeleteResponse</a></code>
25
23
  - <code title="get /clusters/regions">client.beta.clusters.<a href="./src/together/resources/beta/clusters/clusters.py">list_regions</a>() -> <a href="./src/together/types/beta/cluster_list_regions_response.py">ClusterListRegionsResponse</a></code>
@@ -29,17 +27,12 @@ Methods:
29
27
  Types:
30
28
 
31
29
  ```python
32
- from together.types.beta.clusters import (
33
- ClusterStorage,
34
- StorageCreateResponse,
35
- StorageListResponse,
36
- StorageDeleteResponse,
37
- )
30
+ from together.types.beta.clusters import ClusterStorage, StorageListResponse, StorageDeleteResponse
38
31
  ```
39
32
 
40
33
  Methods:
41
34
 
42
- - <code title="post /clusters/storages">client.beta.clusters.storage.<a href="./src/together/resources/beta/clusters/storage.py">create</a>(\*\*<a href="src/together/types/beta/clusters/storage_create_params.py">params</a>) -> <a href="./src/together/types/beta/clusters/storage_create_response.py">StorageCreateResponse</a></code>
35
+ - <code title="post /clusters/storages">client.beta.clusters.storage.<a href="./src/together/resources/beta/clusters/storage.py">create</a>(\*\*<a href="src/together/types/beta/clusters/storage_create_params.py">params</a>) -> <a href="./src/together/types/beta/clusters/cluster_storage.py">ClusterStorage</a></code>
43
36
  - <code title="get /clusters/storages/{volume_id}">client.beta.clusters.storage.<a href="./src/together/resources/beta/clusters/storage.py">retrieve</a>(volume_id) -> <a href="./src/together/types/beta/clusters/cluster_storage.py">ClusterStorage</a></code>
44
37
  - <code title="put /clusters/storages">client.beta.clusters.storage.<a href="./src/together/resources/beta/clusters/storage.py">update</a>(\*\*<a href="src/together/types/beta/clusters/storage_update_params.py">params</a>) -> <a href="./src/together/types/beta/clusters/cluster_storage.py">ClusterStorage</a></code>
45
38
  - <code title="get /clusters/storages">client.beta.clusters.storage.<a href="./src/together/resources/beta/clusters/storage.py">list</a>() -> <a href="./src/together/types/beta/clusters/storage_list_response.py">StorageListResponse</a></code>
@@ -0,0 +1,259 @@
1
+ import os
2
+ import logging
3
+ import argparse
4
+ from typing import Dict, List
5
+ from functools import partial
6
+ from multiprocessing import cpu_count
7
+
8
+ from datasets import Dataset, load_dataset # type: ignore
9
+ from transformers import ( # type: ignore
10
+ AutoTokenizer,
11
+ BatchEncoding,
12
+ PreTrainedTokenizerBase,
13
+ )
14
+
15
+ # see default of ignore_index
16
+ # for https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss
17
+ LOSS_IGNORE_INDEX = -100
18
+
19
+ logger = logging.getLogger(__name__)
20
+ logging.basicConfig(level=logging.INFO)
21
+
22
+
23
+ def tokenize_variable_length(
24
+ data: Dict[str, str],
25
+ tokenizer: PreTrainedTokenizerBase,
26
+ add_special_tokens: bool = True,
27
+ ) -> BatchEncoding:
28
+ tokenized = tokenizer(data["text"], add_special_tokens=add_special_tokens, truncation=False)
29
+ return tokenized
30
+
31
+
32
+ def tokenize_constant_length(
33
+ data: Dict[str, str],
34
+ tokenizer: PreTrainedTokenizerBase,
35
+ max_length: int = 2048,
36
+ add_special_tokens: bool = True,
37
+ add_labels: bool = True,
38
+ ) -> BatchEncoding:
39
+ # tokenized contains `input_ids` and `attention_mask`
40
+ tokenized: BatchEncoding = tokenizer(
41
+ data["text"],
42
+ max_length=max_length,
43
+ truncation=True,
44
+ padding="max_length",
45
+ add_special_tokens=add_special_tokens,
46
+ )
47
+ # add labels to mask out any padding tokens
48
+ if add_labels:
49
+ tokenized["labels"] = [
50
+ LOSS_IGNORE_INDEX if token_id == tokenizer.pad_token_id else token_id for token_id in tokenized["input_ids"]
51
+ ]
52
+
53
+ return tokenized
54
+
55
+
56
+ def pack_sequences(
57
+ batch: BatchEncoding,
58
+ max_seq_len: int,
59
+ pad_token_id: int,
60
+ eos_token_id: int,
61
+ add_labels: bool,
62
+ cutoff_size: int = 0,
63
+ ) -> Dict[str, List[List[int]]]:
64
+ """
65
+ cutoff_size = max_seq_len means that we will drop any non-full sequences
66
+ (full packing without padding)
67
+ Example:
68
+ Sequence 1:
69
+ ['<s>', '▁usually', '▁,', '▁he', '▁would', '▁be', '▁t', 'earing']
70
+ Sequence 2:
71
+ ['▁around', '▁the', '▁living', '▁room', '▁,', '▁playing', '▁with', '▁his']
72
+ Sequence 3:
73
+ ['▁toys', '▁.', '</s>', '<s>', '▁but', '▁just', '▁one', '▁look']
74
+ """
75
+ packed_sequences = []
76
+ buffer = []
77
+
78
+ for input_ids in batch["input_ids"]:
79
+ # Add the current sequence to the buffer
80
+ buffer.extend(input_ids)
81
+ buffer.append(eos_token_id) # Add EOS at the end of each sequence
82
+
83
+ # Check if buffer needs to be split into chunks
84
+ while len(buffer) > max_seq_len:
85
+ # Take a full chunk from the buffer and append it to packed_sequences
86
+ packed_sequences.append(buffer[:max_seq_len])
87
+ # Remove the processed chunk from the buffer
88
+ buffer = buffer[max_seq_len:]
89
+
90
+ # Add the last buffer if it's exactly chunk_size
91
+ if len(buffer) == max_seq_len:
92
+ packed_sequences.append(buffer)
93
+ elif len(buffer) > cutoff_size:
94
+ # if the buffer is larger than the cutoff size, pad it to the chunk_size
95
+ # if not, we do not include in the packed_sequences
96
+ buffer.extend([pad_token_id] * (max_seq_len - len(buffer)))
97
+ packed_sequences.append(buffer)
98
+
99
+ output = {"input_ids": packed_sequences}
100
+ if add_labels:
101
+ output["labels"] = [
102
+ [LOSS_IGNORE_INDEX if token_id == pad_token_id else token_id for token_id in example]
103
+ for example in output["input_ids"]
104
+ ]
105
+
106
+ # mask attention for padding tokens, a better version would also mask cross-sequence dependencies
107
+ output["attention_mask"] = [
108
+ [0 if token_id == pad_token_id else 1 for token_id in example] for example in output["input_ids"]
109
+ ]
110
+ return output
111
+
112
+
113
+ def process_fast_packing(
114
+ dataset: Dataset,
115
+ tokenizer: PreTrainedTokenizerBase,
116
+ max_sequence_length: int,
117
+ add_labels: bool,
118
+ add_special_tokens: bool,
119
+ ) -> Dataset:
120
+ tokenized_dataset = dataset.map(
121
+ lambda examples: tokenize_variable_length(examples, tokenizer, add_special_tokens=add_special_tokens),
122
+ batched=True,
123
+ num_proc=cpu_count(),
124
+ load_from_cache_file=True,
125
+ remove_columns=dataset.column_names,
126
+ )
127
+ logger.info(f"tokenized dataset: {tokenized_dataset}")
128
+
129
+ packed_dataset = tokenized_dataset.map(
130
+ lambda batch: pack_sequences(
131
+ batch,
132
+ max_sequence_length,
133
+ tokenizer.pad_token_id,
134
+ tokenizer.eos_token_id,
135
+ add_labels=add_labels,
136
+ cutoff_size=max_sequence_length,
137
+ ),
138
+ batched=True,
139
+ num_proc=cpu_count() if len(tokenized_dataset) > 10000 else 1,
140
+ remove_columns=["attention_mask"],
141
+ )
142
+ logger.info(f"Packed dataset: {packed_dataset}")
143
+ return packed_dataset
144
+
145
+
146
+ def process_data(args: argparse.Namespace) -> None:
147
+ if not args.out_filename.endswith(".parquet"):
148
+ raise ValueError("`--out_filename` should have the `.parquet` extension")
149
+
150
+ if os.path.isfile(args.dataset) and args.dataset.endswith(".jsonl"):
151
+ dataset = load_dataset("json", data_files=args.dataset, split="train")
152
+ else:
153
+ dataset = load_dataset(args.dataset, split="train")
154
+ tokenizer = AutoTokenizer.from_pretrained(args.tokenizer)
155
+ tokenizer.pad_token = tokenizer.eos_token
156
+
157
+ # Handle prompt/completion format by combining into text field
158
+ prompt_field = args.prompt_field
159
+ completion_field = args.completion_field
160
+ separator = args.separator
161
+
162
+ if prompt_field in dataset.column_names and completion_field in dataset.column_names:
163
+ if "text" not in dataset.column_names:
164
+ dataset = dataset.map(
165
+ lambda x: {"text": x[prompt_field] + separator + x[completion_field]},
166
+ remove_columns=[prompt_field, completion_field],
167
+ )
168
+ elif "text" not in dataset.column_names:
169
+ raise ValueError(
170
+ f"Dataset must have either 'text' field or both '{prompt_field}' and '{completion_field}' fields. "
171
+ f"Available columns: {dataset.column_names}"
172
+ )
173
+
174
+ if not args.packing:
175
+ tokenized_data = dataset.map(
176
+ partial(
177
+ tokenize_constant_length,
178
+ tokenizer=tokenizer,
179
+ max_length=args.max_seq_length,
180
+ add_special_tokens=True,
181
+ add_labels=args.add_labels,
182
+ ),
183
+ batched=False,
184
+ num_proc=cpu_count(),
185
+ remove_columns=dataset.column_names,
186
+ )
187
+ else:
188
+ tokenized_data = process_fast_packing(
189
+ dataset,
190
+ tokenizer,
191
+ max_sequence_length=args.max_seq_length,
192
+ add_labels=args.add_labels,
193
+ add_special_tokens=True,
194
+ )
195
+
196
+ assert "input_ids" in tokenized_data.column_names and "attention_mask" in tokenized_data.column_names
197
+
198
+ if args.add_labels:
199
+ assert "labels" in tokenized_data.column_names
200
+
201
+ logger.info("Tokenized data:")
202
+ print(tokenized_data)
203
+
204
+ logger.info(f"Saving data to {args.out_filename}")
205
+ print(len(tokenized_data[0]["input_ids"]))
206
+ tokenized_data.to_parquet(args.out_filename)
207
+
208
+
209
+ if __name__ == "__main__":
210
+ parser = argparse.ArgumentParser(description="Pretokenize examples for finetuning via Together")
211
+ parser.add_argument(
212
+ "--dataset",
213
+ type=str,
214
+ default="clam004/antihallucination_dataset",
215
+ help="Dataset name on the Hugging Face Hub or path to local JSONL file",
216
+ )
217
+ parser.add_argument("--max-seq-length", type=int, default=8192, help="Maximum sequence length")
218
+ parser.add_argument(
219
+ "--add-labels",
220
+ action="store_true",
221
+ help="Whether to add loss labels from padding tokens",
222
+ )
223
+ parser.add_argument(
224
+ "--tokenizer",
225
+ type=str,
226
+ required=True,
227
+ help="Tokenizer name (for example, togethercomputer/Llama-3-8b-hf)",
228
+ )
229
+ parser.add_argument(
230
+ "--out-filename",
231
+ default="processed_dataset.parquet",
232
+ help="Name of the Parquet file to save (should have .parquet extension)",
233
+ )
234
+ parser.add_argument(
235
+ "--packing",
236
+ action="store_true",
237
+ help="Whether to pack shorter sequences up to `--max-seq-length`",
238
+ )
239
+ parser.add_argument(
240
+ "--prompt-field",
241
+ type=str,
242
+ default="prompt",
243
+ help="Name of the field containing the prompt/input text (default: 'prompt')",
244
+ )
245
+ parser.add_argument(
246
+ "--completion-field",
247
+ type=str,
248
+ default="completion",
249
+ help="Name of the field containing the completion/output text (default: 'completion')",
250
+ )
251
+ parser.add_argument(
252
+ "--separator",
253
+ type=str,
254
+ default="",
255
+ help="Separator to insert between prompt and completion fields (default: empty string)",
256
+ )
257
+ args = parser.parse_args()
258
+
259
+ process_data(args)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "together"
3
- version = "2.0.0-alpha.15"
3
+ version = "2.0.0-alpha.17"
4
4
  description = "The official Python library for the together API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -15,14 +15,15 @@ dependencies = [
15
15
  "anyio>=3.5.0, <5",
16
16
  "distro>=1.7.0, <2",
17
17
  "sniffio",
18
- "click>=8.1.7",
19
- "rich>=13.7.1",
20
- "tabulate>=0.9.0",
21
- "pillow>=10.4.0",
22
- "types-tabulate>=0.9.0.20240106",
23
- "tqdm>=4.67.1",
24
- "types-tqdm>=4.67.0.20250516",
25
- "filelock>=3.13.1",
18
+ "click>=8.1.7",
19
+ "rich>=13.7.1",
20
+ "tabulate>=0.9.0",
21
+ "pillow>=10.4.0",
22
+ "types-tabulate>=0.9.0.20240106",
23
+ "tqdm>=4.67.1",
24
+ "types-tqdm>=4.67.0.20250516",
25
+ "filelock>=3.13.1",
26
+ "types-pyyaml>=6.0.12.20250915",
26
27
  ]
27
28
 
28
29
  requires-python = ">= 3.9"
@@ -51,9 +52,10 @@ Repository = "https://github.com/togethercomputer/together-py"
51
52
  [project.optional-dependencies]
52
53
  aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
53
54
  pyarrow = ["pyarrow>=16.1.0", "pyarrow-stubs>=10.0.1.7"]
55
+ cli = ["PyYAML"]
54
56
 
55
57
  [project.scripts]
56
- together = "together.lib.cli.cli:main"
58
+ together = "together.lib.cli:main"
57
59
 
58
60
  [tool.uv]
59
61
  managed = true
@@ -150,6 +152,7 @@ exclude = [
150
152
  ".venv",
151
153
  ".nox",
152
154
  ".git",
155
+ "examples",
153
156
  ]
154
157
 
155
158
  reportImplicitOverride = true