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.
- together-2.0.0a17/.release-please-manifest.json +3 -0
- {together-2.0.0a15 → together-2.0.0a17}/CHANGELOG.md +34 -0
- {together-2.0.0a15 → together-2.0.0a17}/PKG-INFO +4 -2
- {together-2.0.0a15 → together-2.0.0a17}/README.md +0 -1
- {together-2.0.0a15 → together-2.0.0a17}/api.md +4 -11
- together-2.0.0a17/examples/tokenize_data.py +259 -0
- {together-2.0.0a15 → together-2.0.0a17}/pyproject.toml +13 -10
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_base_client.py +134 -11
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_client.py +7 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_models.py +16 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_types.py +9 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_version.py +1 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/constants.py +1 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/error.py +1 -2
- together-2.0.0a17/src/together/lib/_google_colab.py +39 -0
- together-2.0.0a15/src/together/lib/cli/cli.py → together-2.0.0a17/src/together/lib/cli/__init__.py +1 -1
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/__init__.py +47 -0
- 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
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/delete.py +35 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/get_credentials.py +151 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/list.py +24 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/list_regions.py +37 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/retrieve.py +31 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/__init__.py +19 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/create.py +49 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/delete.py +38 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/list.py +42 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/storage/retrieve.py +34 -0
- together-2.0.0a17/src/together/lib/cli/api/beta/clusters/update.py +54 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/__init__.py +56 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/availability_zones.py +26 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/create.py +161 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/delete.py +15 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/hardware.py +40 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/list.py +66 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/retrieve.py +23 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/start.py +25 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/stop.py +25 -0
- together-2.0.0a17/src/together/lib/cli/api/endpoints/update.py +77 -0
- together-2.0.0a17/src/together/lib/cli/api/evals/__init__.py +19 -0
- 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
- together-2.0.0a17/src/together/lib/cli/api/evals/list.py +58 -0
- together-2.0.0a17/src/together/lib/cli/api/evals/retrieve.py +21 -0
- together-2.0.0a17/src/together/lib/cli/api/evals/status.py +20 -0
- together-2.0.0a17/src/together/lib/cli/api/files/__init__.py +23 -0
- together-2.0.0a17/src/together/lib/cli/api/files/check.py +21 -0
- together-2.0.0a17/src/together/lib/cli/api/files/delete.py +20 -0
- together-2.0.0a17/src/together/lib/cli/api/files/list.py +34 -0
- together-2.0.0a17/src/together/lib/cli/api/files/retrieve.py +20 -0
- together-2.0.0a17/src/together/lib/cli/api/files/retrieve_content.py +25 -0
- together-2.0.0a17/src/together/lib/cli/api/files/upload.py +38 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/__init__.py +27 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/cancel.py +28 -0
- 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
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/delete.py +29 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/download.py +94 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list.py +44 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list_checkpoints.py +42 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/list_events.py +35 -0
- together-2.0.0a17/src/together/lib/cli/api/fine_tuning/retrieve.py +27 -0
- together-2.0.0a17/src/together/lib/cli/api/models/__init__.py +15 -0
- together-2.0.0a17/src/together/lib/cli/api/models/list.py +55 -0
- 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
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/clusters.py +36 -28
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/storage.py +30 -21
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/endpoints.py +2 -2
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/__init__.py +4 -3
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/__init__.py +0 -2
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_create_params.py +3 -3
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/__init__.py +0 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/cluster_storage.py +4 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat_completions.py +1 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_create_params.py +1 -1
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoints.py +1 -1
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/clusters/test_storage.py +6 -7
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/test_clusters.py +18 -26
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_cli_utils.py +2 -2
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_client.py +185 -2
- {together-2.0.0a15 → together-2.0.0a17}/uv.lock +90 -2
- together-2.0.0a15/.release-please-manifest.json +0 -3
- together-2.0.0a15/src/together/lib/cli/api/beta/clusters_storage.py +0 -152
- together-2.0.0a15/src/together/lib/cli/api/endpoints.py +0 -467
- together-2.0.0a15/src/together/lib/cli/api/files.py +0 -133
- together-2.0.0a15/src/together/types/beta/cluster_create_response.py +0 -9
- together-2.0.0a15/src/together/types/beta/cluster_update_response.py +0 -9
- together-2.0.0a15/src/together/types/beta/clusters/storage_create_response.py +0 -9
- together-2.0.0a15/tests/integration/__init__.py +0 -0
- together-2.0.0a15/tests/integration/resources/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/.gitignore +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/CONTRIBUTING.md +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/LICENSE +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/SECURITY.md +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/bin/check-release-environment +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/bin/publish-pypi +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/.keep +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/coqa-small.jsonl +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/coqa.jsonl +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/embedding.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/file-upload.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/fine_tuning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/image.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/models.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/examples/streaming.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/release-please-config.json +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/requirements-dev.lock +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_compat.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_constants.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_exceptions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_qs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_resource.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_streaming.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_compat.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_datetime_parse.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_logs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_proxy.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_reflection.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_resources_proxy.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_streams.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_sync.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_transform.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_typing.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/_utils/_utils.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/.keep +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/__init__.py +0 -0
- /together-2.0.0a15/src/together/lib/cli/api/utils.py → /together-2.0.0a17/src/together/lib/cli/api/_utils.py +0 -0
- /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
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/constants.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/resources/fine_tuning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/error.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/types/fine_tuning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/_log.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/serializer.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/lib/utils/tools.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/py.typed +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/audio.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/speech.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/transcriptions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/translations.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/audio/voices.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/batches.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/beta.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/beta/clusters/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/chat.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/chat/completions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/code_interpreter.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/code_interpreter/sessions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/completions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/embeddings.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/evals.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/fine_tuning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/hardware.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/images.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/jobs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/models.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/rerank.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/resources/videos.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/speech_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/transcription_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/transcription_create_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/translation_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/translation_create_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio/voice_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/audio_speech_stream_chunk.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/autoscaling.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/autoscaling_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_create_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_job.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/batch_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_delete_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_list_regions_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/cluster_update_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_delete_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/beta/clusters/storage_update_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_chunk.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_image_url_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_text_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_structured_message_video_url_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_usage.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/chat_completion_warning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/chat/completion_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter/session_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/code_interpreter_execute_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion_chunk.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/completion_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/dedicated_endpoint.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/embedding.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/embedding_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_avzones_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/endpoint_update_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_create_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_list_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/eval_status_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/evaluation_job.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/execute_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_delete_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_list.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_purpose.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/file_type.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_cancel_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_content_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_delete_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_delete_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_estimate_price_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_estimate_price_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_checkpoints_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_events_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/fine_tuning_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_event.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_event_type.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/finetune_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/hardware_list_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/hardware_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_data_b64.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_data_url.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_file.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/image_generate_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/job_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/job_retrieve_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/log_probs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_list_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_list_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_object.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_upload_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/model_upload_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/models.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/rerank_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/rerank_create_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tool_choice.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tool_choice_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/tools_param.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/training_method_dpo.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/training_method_sft.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/video_create_params.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/src/together/types/video_job.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_speech.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_transcriptions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_translations.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/audio/test_voices.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/beta/clusters/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/chat/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/chat/test_completions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/code_interpreter/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/code_interpreter/test_sessions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_batches.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_code_interpreter.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_completions.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_embeddings.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_endpoints.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_evals.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_fine_tuning.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_hardware.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_images.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_jobs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_models.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_rerank.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/api_resources/test_videos.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/conftest.py +0 -0
- {together-2.0.0a15/src/together/lib/cli → together-2.0.0a17/tests/integration}/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/integration/constants.py +0 -0
- {together-2.0.0a15/src/together/lib/cli/api → together-2.0.0a17/tests/integration/resources}/__init__.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/generate_hyperparameters.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_completion.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_completion_stream.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/integration/resources/test_files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/sample_file.txt +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_deepcopy.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_extract_files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_files.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_models.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_qs.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_required_args.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_response.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_streaming.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_transform.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_datetime_parse.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_proxy.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/test_utils/test_typing.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_async_client.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_client.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_code_interpreter.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_files_checks.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_files_resource.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_fine_tuning_resources.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_imports.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_multipart_upload_manager.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_preference_openai.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/unit/test_video_url.py +0 -0
- {together-2.0.0a15 → together-2.0.0a17}/tests/utils.py +0 -0
|
@@ -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.
|
|
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",
|
|
@@ -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/
|
|
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/
|
|
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/
|
|
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.
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
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
|