truss 0.9.12.dev2__tar.gz → 0.9.13__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.
- {truss-0.9.12.dev2 → truss-0.9.13}/PKG-INFO +1 -1
- {truss-0.9.12.dev2 → truss-0.9.13}/pyproject.toml +2 -2
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/cli/cli.py +11 -11
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/config/trt_llm.py +1 -1
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/constants.py +15 -2
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/image_builder/serving_image_builder.py +9 -2
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/service.py +1 -1
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/requirements.txt +1 -1
- truss-0.9.13/truss/templates/trtllm-briton/model/model.py +173 -0
- truss-0.9.13/truss/templates/trtllm-briton/packages/briton_pb2.py +38 -0
- truss-0.9.13/truss/templates/trtllm-briton/packages/briton_pb2_grpc.py +112 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_basic_truss/config.yaml +3 -1
- truss-0.9.13/truss/tests/local/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_config.py +42 -14
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/truss_config.py +17 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/validation.py +4 -3
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/__init__.py +2 -2
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/code_gen.py +11 -7
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/definitions.py +48 -25
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/deploy.py +1 -1
- truss-0.9.13/truss-chains/truss_chains/example_chainlet.py +30 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/framework.py +209 -135
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/model_skeleton.py +1 -1
- truss-0.9.13/truss-chains/truss_chains/public_api.py +84 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/stub.py +1 -1
- {truss-0.9.12.dev2 → truss-0.9.13}/truss-chains/truss_chains/utils.py +0 -1
- truss-0.9.12.dev2/truss-chains/truss_chains/example_chainlet.py +0 -37
- truss-0.9.12.dev2/truss-chains/truss_chains/public_api.py +0 -73
- {truss-0.9.12.dev2 → truss-0.9.13}/CODE_OF_CONDUCT.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/CONTRIBUTING.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/LICENSE +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/README.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/context_builder.Dockerfile +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/blob/blob_backend.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/blob/blob_backend_registry.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/blob/http_public_blob_backend.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/build.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/cli/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/cli/console.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/cli/create.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/image_builder/cache_warmer.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/image_builder/image_builder.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/image_builder/util.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/local_loader/docker_build_emulator.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/local_loader/load_model_local.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/local_loader/truss_module_loader.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/local_loader/utils.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/contexts/truss_context.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/decorators.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/docker.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/errors.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/local/local_config.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/local/local_config_handler.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/model_inference.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/notebook.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/calc_patch.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/constants.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/dir_signature.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/hash.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/local_truss_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/signature.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/truss_dir_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/patch/types.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/readme_generator.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/api.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/auth.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/core.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/error.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/remote.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/utils/tar.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/baseten/utils/transfer.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/remote_cli.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/remote_factory.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/remote/truss_remote.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/README.md.jinja +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/base.Dockerfile.jinja +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/cache.Dockerfile.jinja +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/cache_requirements.txt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/application.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/endpoints.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/context_managers.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/errors.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/inference_server_controller.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/inference_server_process_controller.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/inference_server_starter.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/truss_patch/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/truss_patch/model_code_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/truss_patch/requirement_name_identifier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/truss_patch/system_packages.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/helpers/types.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/control/control/server.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/copy_cache_files.Dockerfile.jinja +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/custom/examples.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/custom/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/custom/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/errors.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/patches/whisper/patch.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/patches.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/retry.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/schema.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/termination_handler_middleware.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/common/truss_server.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/inference_server.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/model_wrapper.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server/requirements.txt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/server.Dockerfile.jinja +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/README.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/logging.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/secrets_resolver.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/serialization.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/shared/util.py +0 -0
- /truss-0.9.12.dev2/truss/test_data/annotated_types_truss/model/__init__.py → /truss-0.9.13/truss/templates/trtllm/README.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/constants.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/schema.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/ensemble/config.pbtxt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/postprocessing/1/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/postprocessing/config.pbtxt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/preprocessing/1/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/preprocessing/config.pbtxt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/tensorrt_llm_model_repository/tensorrt_llm/config.pbtxt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/triton_client.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/templates/trtllm/packages/utils.py +0 -0
- {truss-0.9.12.dev2/truss/templates/trtllm → truss-0.9.13/truss/templates/trtllm-briton}/README.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/annotated_types_truss/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/gcs_fix → truss-0.9.13/truss/test_data/annotated_types_truss}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/annotated_types_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/auto-mpg.data +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/context_builder_image_test/Dockerfile +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/context_builder_image_test/test.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/gcs_fix/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/server_conformance_test_truss → truss-0.9.13/truss/test_data/gcs_fix}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/gcs_fix/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/happy.ipynb +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/model_load_failure_test/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/model_load_failure_test/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/patch_ping_test_server/app.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/pima-indians-diabetes.csv +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/readme_int_example.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/readme_no_example.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/readme_str_example.md +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/server.Dockerfile +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/server_conformance_test_truss/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_basic_truss → truss-0.9.13/truss/test_data/server_conformance_test_truss}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/server_conformance_test_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_async_truss/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_async_truss/model/model.py +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_pyantic_v1 → truss-0.9.13/truss/test_data/test_basic_truss}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_basic_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_concurrency_truss/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_concurrency_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v1/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_pyantic_v2 → truss-0.9.13/truss/test_data/test_pyantic_v1}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v1/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v1/requirements.txt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v2/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_requirements_file_truss → truss-0.9.13/truss/test_data/test_pyantic_v2}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v2/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_pyantic_v2/requirements.txt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_requirements_file_truss/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_truss → truss-0.9.13/truss/test_data/test_requirements_file_truss}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_requirements_file_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_requirements_file_truss/requirements.txt +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_async_generator_truss/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_async_generator_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_read_timeout/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_read_timeout/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_truss/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_truss_with_error/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_streaming_truss_with_error/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss/config.yaml +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss/examples.yaml +0 -0
- {truss-0.9.12.dev2/truss/test_data/test_truss_server_caching_truss → truss-0.9.13/truss/test_data/test_truss}/model/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss/model/dummy +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss/model/model.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss/packages/test_package/test.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss_server_caching_truss/config.yaml +0 -0
- {truss-0.9.12.dev2/truss/tests → truss-0.9.13/truss/test_data/test_truss_server_caching_truss/model}/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/test_data/test_truss_server_caching_truss/model/model.py +0 -0
- {truss-0.9.12.dev2/truss/tests/local → truss-0.9.13/truss/tests}/__init__.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/conftest.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/contexts/image_builder/test_serving_image_builder.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/contexts/local_loader/test_load_local.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/contexts/local_loader/test_truss_module_finder.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/helpers.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/local/test_local_config_handler.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_calc_patch.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_dir_signature.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_hash.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_signature.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_truss_dir_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/patch/test_types.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/baseten/test_api.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/baseten/test_auth.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/baseten/test_core.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/baseten/test_remote.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/test_remote_factory.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/remote/test_truss_remote.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/control/control/helpers/test_context_managers.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/control/control/helpers/test_model_container_patch_applier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/control/control/helpers/test_requirement_name_identifier.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/control/control/test_server.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/control/control/test_server_integration.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/core/server/common/test_truss_server.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/core/server/common/test_util.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/core/server/test_secrets_resolver.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/server/common/test_retry.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/server/common/test_termination_handler_middleware.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/server/test_model_wrapper.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/templates/server/test_schema.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_build.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_context_builder_image.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_control_truss_patching.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_docker.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_model_inference.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_model_schema.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_testing_utilities_for_other_tests.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_truss_gatherer.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_truss_handle.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_util.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/test_validation.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/tests/util/test_path.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/truss_gatherer.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/truss_handle.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/truss_spec.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/types.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/.truss_ignore +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/data_structures.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/download.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/errors.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/gpu.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/jinja.py +0 -0
- {truss-0.9.12.dev2 → truss-0.9.13}/truss/util/path.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "truss"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.13"
|
|
4
4
|
description = "A seamless bridge from model development to model delivery"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
readme = "README.md"
|
|
@@ -117,7 +117,7 @@ src_paths = ["isort", "test"]
|
|
|
117
117
|
[tool.mypy]
|
|
118
118
|
ignore_missing_imports = true
|
|
119
119
|
python_version = "3.9"
|
|
120
|
-
|
|
120
|
+
plugins = ["pydantic.mypy"]
|
|
121
121
|
|
|
122
122
|
[tool.pytest.ini_options]
|
|
123
123
|
markers = [
|
|
@@ -635,7 +635,7 @@ def predict(
|
|
|
635
635
|
"specifying, the command will not complete until the deployment is complete."
|
|
636
636
|
),
|
|
637
637
|
)
|
|
638
|
-
|
|
638
|
+
@error_handling
|
|
639
639
|
def push(
|
|
640
640
|
target_directory: str,
|
|
641
641
|
remote: str,
|
|
@@ -670,6 +670,16 @@ def push(
|
|
|
670
670
|
tr.spec.config.model_name = model_name
|
|
671
671
|
tr.spec.config.write_to_yaml_file(tr.spec.config_path, verbose=False)
|
|
672
672
|
|
|
673
|
+
# Log a warning if using secrets without --trusted.
|
|
674
|
+
# TODO(helen): this could be moved to a separate function that includes more
|
|
675
|
+
# config checks.
|
|
676
|
+
if tr.spec.config.secrets and not trusted:
|
|
677
|
+
not_trusted_text = (
|
|
678
|
+
"Warning: your Truss has secrets but was not pushed with --trusted. "
|
|
679
|
+
"Please push with --trusted to grant access to secrets."
|
|
680
|
+
)
|
|
681
|
+
console.print(not_trusted_text, style="red")
|
|
682
|
+
|
|
673
683
|
# TODO(Abu): This needs to be refactored to be more generic
|
|
674
684
|
service = remote_provider.push(
|
|
675
685
|
tr,
|
|
@@ -698,16 +708,6 @@ def push(
|
|
|
698
708
|
|
|
699
709
|
click.echo(draft_model_text)
|
|
700
710
|
|
|
701
|
-
# Log a warning if using secrets without --trusted.
|
|
702
|
-
# TODO(helen): this could be moved to a separate function that includes more
|
|
703
|
-
# config checks.
|
|
704
|
-
if tr.spec.config.secrets and not trusted:
|
|
705
|
-
not_trusted_text = (
|
|
706
|
-
"Warning: your Truss has secrets but was not pushed with --trusted."
|
|
707
|
-
"Please push with --trusted to grant access to secrets."
|
|
708
|
-
)
|
|
709
|
-
console.print(not_trusted_text, style="red")
|
|
710
|
-
|
|
711
711
|
if promote:
|
|
712
712
|
promotion_text = (
|
|
713
713
|
"Your Truss has been deployed as a production model. After it successfully "
|
|
@@ -29,7 +29,7 @@ class TrussTRTLLMQuantizationType(str, Enum):
|
|
|
29
29
|
class TrussTRTLLMPluginConfiguration(BaseModel):
|
|
30
30
|
multi_block_mode: bool = False
|
|
31
31
|
paged_kv_cache: bool = True
|
|
32
|
-
|
|
32
|
+
gemm_plugin: str = "float16"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class CheckpointSource(Enum):
|
|
@@ -2,6 +2,8 @@ import os
|
|
|
2
2
|
import pathlib
|
|
3
3
|
from typing import Set
|
|
4
4
|
|
|
5
|
+
USE_BRITON = os.environ.get("USE_BRITON_FOR_TRTLLM", False)
|
|
6
|
+
|
|
5
7
|
SKLEARN = "sklearn"
|
|
6
8
|
TENSORFLOW = "tensorflow"
|
|
7
9
|
KERAS = "keras"
|
|
@@ -17,7 +19,11 @@ CODE_DIR = pathlib.Path(BASE_DIR, "truss")
|
|
|
17
19
|
TEMPLATES_DIR = pathlib.Path(CODE_DIR, "templates")
|
|
18
20
|
SERVER_CODE_DIR: pathlib.Path = TEMPLATES_DIR / "server"
|
|
19
21
|
TRITON_SERVER_CODE_DIR: pathlib.Path = TEMPLATES_DIR / "triton"
|
|
20
|
-
|
|
22
|
+
TRTLLM_BRITON_TRUSS_DIR: pathlib.Path = TEMPLATES_DIR / "trtllm-briton"
|
|
23
|
+
TRTLLM_TRITON_TRUSS_DIR: pathlib.Path = TEMPLATES_DIR / "trtllm"
|
|
24
|
+
TRTLLM_TRUSS_DIR: pathlib.Path = (
|
|
25
|
+
TRTLLM_BRITON_TRUSS_DIR if USE_BRITON else TRTLLM_TRITON_TRUSS_DIR
|
|
26
|
+
)
|
|
21
27
|
SHARED_SERVING_AND_TRAINING_CODE_DIR_NAME = "shared"
|
|
22
28
|
SHARED_SERVING_AND_TRAINING_CODE_DIR: pathlib.Path = (
|
|
23
29
|
TEMPLATES_DIR / SHARED_SERVING_AND_TRAINING_CODE_DIR_NAME
|
|
@@ -99,11 +105,18 @@ HTTP_PUBLIC_BLOB_BACKEND = "http_public"
|
|
|
99
105
|
REGISTRY_BUILD_SECRET_PREFIX = "DOCKER_REGISTRY_"
|
|
100
106
|
|
|
101
107
|
TRTLLM_BASE_IMAGE = "baseten/triton_trt_llm:v0.9.0"
|
|
108
|
+
BRITON_TRTLLM_BASE_IMAGE = "baseten/briton-server:v0.0.1"
|
|
102
109
|
TRTLLM_PYTHON_EXECUTABLE = "/usr/bin/python3"
|
|
103
110
|
BASE_TRTLLM_REQUIREMENTS = [
|
|
104
111
|
"tritonclient[all]==2.42.0",
|
|
105
112
|
"transformers==4.40.2",
|
|
106
113
|
"jinja2==3.1.3",
|
|
107
|
-
"truss==0.9.
|
|
114
|
+
"truss==0.9.12",
|
|
115
|
+
]
|
|
116
|
+
BRITON_BASE_TRTLLM_REQUIREMENTS = [
|
|
117
|
+
"grpcio==1.64.0",
|
|
118
|
+
"grpcio-tools==1.64.0",
|
|
119
|
+
"transformers==4.41.0",
|
|
120
|
+
"truss==0.9.12",
|
|
108
121
|
]
|
|
109
122
|
OPENAI_COMPATIBLE_TAG = "openai-compatible"
|
|
@@ -15,6 +15,8 @@ from huggingface_hub.utils import filter_repo_objects
|
|
|
15
15
|
from truss.constants import (
|
|
16
16
|
BASE_SERVER_REQUIREMENTS_TXT_FILENAME,
|
|
17
17
|
BASE_TRTLLM_REQUIREMENTS,
|
|
18
|
+
BRITON_BASE_TRTLLM_REQUIREMENTS,
|
|
19
|
+
BRITON_TRTLLM_BASE_IMAGE,
|
|
18
20
|
CONTROL_SERVER_CODE_DIR,
|
|
19
21
|
FILENAME_CONSTANTS_MAP,
|
|
20
22
|
MODEL_DOCKERFILE_NAME,
|
|
@@ -30,6 +32,7 @@ from truss.constants import (
|
|
|
30
32
|
TRTLLM_BASE_IMAGE,
|
|
31
33
|
TRTLLM_PYTHON_EXECUTABLE,
|
|
32
34
|
TRTLLM_TRUSS_DIR,
|
|
35
|
+
USE_BRITON,
|
|
33
36
|
USER_SUPPLIED_REQUIREMENTS_TXT_FILENAME,
|
|
34
37
|
)
|
|
35
38
|
from truss.contexts.image_builder.cache_warmer import (
|
|
@@ -351,10 +354,14 @@ class ServingImageBuilder(ImageBuilder):
|
|
|
351
354
|
)
|
|
352
355
|
|
|
353
356
|
config.base_image = BaseImage(
|
|
354
|
-
image=TRTLLM_BASE_IMAGE,
|
|
357
|
+
image=BRITON_TRTLLM_BASE_IMAGE if USE_BRITON else TRTLLM_BASE_IMAGE,
|
|
355
358
|
python_executable_path=TRTLLM_PYTHON_EXECUTABLE,
|
|
356
359
|
)
|
|
357
|
-
config.requirements.extend(
|
|
360
|
+
config.requirements.extend(
|
|
361
|
+
BRITON_BASE_TRTLLM_REQUIREMENTS
|
|
362
|
+
if USE_BRITON
|
|
363
|
+
else BASE_TRTLLM_REQUIREMENTS
|
|
364
|
+
)
|
|
358
365
|
|
|
359
366
|
config.model_metadata["tags"] = [OPENAI_COMPATIBLE_TAG]
|
|
360
367
|
|
|
@@ -89,7 +89,7 @@ class BasetenService(TrussService):
|
|
|
89
89
|
# will be a json with an `error` key.
|
|
90
90
|
return parsed_response
|
|
91
91
|
|
|
92
|
-
return response.json()
|
|
92
|
+
return response.json()
|
|
93
93
|
|
|
94
94
|
def authenticate(self) -> dict:
|
|
95
95
|
return self._auth_service.authenticate().header()
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import signal
|
|
3
|
+
import socket
|
|
4
|
+
import subprocess
|
|
5
|
+
import threading
|
|
6
|
+
import time
|
|
7
|
+
from itertools import count
|
|
8
|
+
|
|
9
|
+
import briton_pb2
|
|
10
|
+
import briton_pb2_grpc
|
|
11
|
+
import grpc
|
|
12
|
+
from transformers import AutoTokenizer
|
|
13
|
+
from truss.config.trt_llm import TrussTRTLLMBuildConfiguration
|
|
14
|
+
from truss.constants import OPENAI_COMPATIBLE_TAG
|
|
15
|
+
|
|
16
|
+
BRITON_PORT = 50051
|
|
17
|
+
|
|
18
|
+
MODEL_INPUT_TO_BRITON_FIELD = {
|
|
19
|
+
"max_tokens": "request_output_len",
|
|
20
|
+
"beam_width": "beam_width",
|
|
21
|
+
"repetition_penalty": "repetition_penalty",
|
|
22
|
+
"presence_penalty": "presence_penalty",
|
|
23
|
+
"temperature": "temperature",
|
|
24
|
+
"length_penalty": "len_penalty",
|
|
25
|
+
"end_id": "end_id",
|
|
26
|
+
"pad_id": "pad_id",
|
|
27
|
+
"runtime_top_k": "runtime_top_k",
|
|
28
|
+
"runtime_top_p": "runtime_top_p",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def is_port_available(port, host="localhost"):
|
|
33
|
+
try:
|
|
34
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
35
|
+
# Try to connect to the specified host and port
|
|
36
|
+
s.bind((host, port))
|
|
37
|
+
return True
|
|
38
|
+
except OSError:
|
|
39
|
+
# Port is not available
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def briton_monitor(briton_process):
|
|
44
|
+
while True:
|
|
45
|
+
if briton_process.poll() is not None:
|
|
46
|
+
print(
|
|
47
|
+
f"Briton process has exited with code {briton_process.returncode}, exiting truss server"
|
|
48
|
+
)
|
|
49
|
+
pid = os.getpid()
|
|
50
|
+
os.kill(pid, signal.SIGKILL)
|
|
51
|
+
time.sleep(1)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class Model:
|
|
55
|
+
def __init__(self, **kwargs):
|
|
56
|
+
self._model = None
|
|
57
|
+
self._config = kwargs["config"]
|
|
58
|
+
self._data_dir = kwargs["data_dir"]
|
|
59
|
+
self._stub = None
|
|
60
|
+
self._secrets = kwargs["secrets"]
|
|
61
|
+
self._request_id_counter = count(start=1)
|
|
62
|
+
self._briton_process = None
|
|
63
|
+
self._uses_openai_api = OPENAI_COMPATIBLE_TAG in self._config.get(
|
|
64
|
+
"model_metadata", {}
|
|
65
|
+
).get("tags", [])
|
|
66
|
+
|
|
67
|
+
if "trt_llm" not in self._config:
|
|
68
|
+
raise ValueError("trt_llm config is required for this model")
|
|
69
|
+
|
|
70
|
+
trtllm_config = self._config.get("trt_llm")
|
|
71
|
+
truss_trtllm_build_config = TrussTRTLLMBuildConfiguration(
|
|
72
|
+
**trtllm_config.get("build")
|
|
73
|
+
)
|
|
74
|
+
self._tp_count = truss_trtllm_build_config.tensor_parallel_count
|
|
75
|
+
self._tokenizer_repository = (
|
|
76
|
+
truss_trtllm_build_config.checkpoint_repository.repo
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
self._hf_token = None
|
|
80
|
+
try:
|
|
81
|
+
self._hf_token = self._secrets.get("hf_access_token", None)
|
|
82
|
+
except: # noqa
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
def load(self):
|
|
86
|
+
self._tokenizer = AutoTokenizer.from_pretrained(
|
|
87
|
+
self._tokenizer_repository, token=self._hf_token
|
|
88
|
+
)
|
|
89
|
+
# Start engine
|
|
90
|
+
config_str = f'engine_path: "{self._data_dir.resolve()}"\nhf_tokenizer: "{self._tokenizer_repository}"'
|
|
91
|
+
config_pbtxt_path = (self._data_dir / "briton_config.pbtxt").resolve()
|
|
92
|
+
config_pbtxt_path.write_text(config_str)
|
|
93
|
+
briton_env = os.environ.copy()
|
|
94
|
+
if self._hf_token is not None:
|
|
95
|
+
briton_env["HF_ACCESS_TOKEN"] = self._hf_token
|
|
96
|
+
if self._tp_count is None or self._tp_count == 1:
|
|
97
|
+
self._briton_process = subprocess.Popen(
|
|
98
|
+
["Briton", "--config", str(config_pbtxt_path)], env=briton_env
|
|
99
|
+
)
|
|
100
|
+
else:
|
|
101
|
+
self._briton_process = subprocess.Popen(
|
|
102
|
+
[
|
|
103
|
+
"mpirun",
|
|
104
|
+
"--allow-run-as-root",
|
|
105
|
+
"-n",
|
|
106
|
+
f"{self._tp_count}",
|
|
107
|
+
"Briton",
|
|
108
|
+
"--config",
|
|
109
|
+
str(config_pbtxt_path),
|
|
110
|
+
],
|
|
111
|
+
env=briton_env,
|
|
112
|
+
)
|
|
113
|
+
while is_port_available(BRITON_PORT):
|
|
114
|
+
print("Waiting for Briton to start")
|
|
115
|
+
time.sleep(1)
|
|
116
|
+
|
|
117
|
+
briton_monitor_thread = threading.Thread(
|
|
118
|
+
target=briton_monitor, args=(self._briton_process,)
|
|
119
|
+
)
|
|
120
|
+
briton_monitor_thread.start()
|
|
121
|
+
|
|
122
|
+
async def predict(self, model_input):
|
|
123
|
+
if self._stub is None:
|
|
124
|
+
channel = grpc.aio.insecure_channel(f"localhost:{BRITON_PORT}")
|
|
125
|
+
self._stub = briton_pb2_grpc.BritonStub(channel)
|
|
126
|
+
|
|
127
|
+
prompt = model_input.get("prompt", None)
|
|
128
|
+
if prompt is None and "messages" in model_input:
|
|
129
|
+
messages = model_input.pop("messages")
|
|
130
|
+
if self._uses_openai_api:
|
|
131
|
+
prompt = self._tokenizer.apply_chat_template(messages, tokenize=False)
|
|
132
|
+
|
|
133
|
+
if prompt is None or prompt == "":
|
|
134
|
+
yield ""
|
|
135
|
+
return
|
|
136
|
+
request_id = int(str(os.getpid()) + str(next(self._request_id_counter)))
|
|
137
|
+
request = briton_pb2.InferenceRequest(
|
|
138
|
+
request_id=request_id,
|
|
139
|
+
input_text=prompt,
|
|
140
|
+
)
|
|
141
|
+
# Set default end_id and pad_id
|
|
142
|
+
if (
|
|
143
|
+
hasattr(self._tokenizer, "eos_token_id")
|
|
144
|
+
and self._tokenizer.eos_token_id is not None
|
|
145
|
+
):
|
|
146
|
+
request.end_id = self._tokenizer.eos_token_id
|
|
147
|
+
if (
|
|
148
|
+
hasattr(self._tokenizer, "pad_token_id")
|
|
149
|
+
and self._tokenizer.pad_token_id is not None
|
|
150
|
+
):
|
|
151
|
+
request.pad_id = self._tokenizer.pad_token_id
|
|
152
|
+
set_briton_request_fields_from_model_input(model_input, request)
|
|
153
|
+
for words in ["bad_words", "stop_words"]:
|
|
154
|
+
if words in model_input:
|
|
155
|
+
for word in model_input[words].split(","):
|
|
156
|
+
getattr(request, words).append(word)
|
|
157
|
+
|
|
158
|
+
try:
|
|
159
|
+
async for response in self._stub.Infer(request):
|
|
160
|
+
yield response.output_text
|
|
161
|
+
except grpc.RpcError as ex:
|
|
162
|
+
if ex.code() == grpc.StatusCode.INVALID_ARGUMENT:
|
|
163
|
+
print(ex.details())
|
|
164
|
+
except Exception as ex:
|
|
165
|
+
print(f"An error has occurred: {ex}")
|
|
166
|
+
raise ex
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def set_briton_request_fields_from_model_input(model_input, briton_request):
|
|
170
|
+
for model_input_key, briton_field in MODEL_INPUT_TO_BRITON_FIELD.items():
|
|
171
|
+
if model_input_key in model_input:
|
|
172
|
+
model_input_value = model_input[model_input_key]
|
|
173
|
+
setattr(briton_request, briton_field, model_input_value)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
# type: ignore
|
|
3
|
+
|
|
4
|
+
# -*- coding: utf-8 -*-
|
|
5
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
6
|
+
# source: briton.proto
|
|
7
|
+
# Protobuf Python Version: 5.26.1
|
|
8
|
+
"""Generated protocol buffer code."""
|
|
9
|
+
from google.protobuf import descriptor as _descriptor
|
|
10
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
11
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
12
|
+
from google.protobuf.internal import builder as _builder
|
|
13
|
+
|
|
14
|
+
# @@protoc_insertion_point(imports)
|
|
15
|
+
|
|
16
|
+
_sym_db = _symbol_database.Default()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
20
|
+
b'\n\x0c\x62riton.proto\x12\x06\x62riton"\xb0\x04\n\x10InferenceRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\x03\x12\x12\n\ninput_text\x18\x02 \x01(\t\x12\x11\n\tinput_ids\x18\x03 \x03(\x05\x12\x1f\n\x12request_output_len\x18\x05 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06\x65nd_id\x18\x06 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06pad_id\x18\x07 \x01(\rH\x02\x88\x01\x01\x12\x17\n\nbeam_width\x18\n \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0btemperature\x18\x0b \x01(\x02H\x04\x88\x01\x01\x12\x1a\n\rruntime_top_k\x18\x0c \x01(\rH\x05\x88\x01\x01\x12\x1a\n\rruntime_top_p\x18\r \x01(\x02H\x06\x88\x01\x01\x12\x18\n\x0blen_penalty\x18\x0e \x01(\x02H\x07\x88\x01\x01\x12\x1f\n\x12repetition_penalty\x18\x0f \x01(\x02H\x08\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x10 \x01(\x02H\t\x88\x01\x01\x12\x11\n\tbad_words\x18\x11 \x03(\t\x12\x12\n\nstop_words\x18\x12 \x03(\tB\x15\n\x13_request_output_lenB\t\n\x07_end_idB\t\n\x07_pad_idB\r\n\x0b_beam_widthB\x0e\n\x0c_temperatureB\x10\n\x0e_runtime_top_kB\x10\n\x0e_runtime_top_pB\x0e\n\x0c_len_penaltyB\x15\n\x13_repetition_penaltyB\x13\n\x11_presence_penalty"R\n\x13InferenceAnswerPart\x12\x12\n\nrequest_id\x18\x01 \x01(\x03\x12\x13\n\x0boutput_text\x18\x02 \x01(\t\x12\x12\n\noutput_ids\x18\x03 \x03(\x05"\xfa\x03\n\x0c\x42ritonConfig\x12\x13\n\x0b\x65ngine_path\x18\x01 \x01(\t\x12\x14\n\x0chf_tokenizer\x18\x02 \x01(\t\x12N\n\x16\x62\x61tch_scheduler_policy\x18\x05 \x01(\x0e\x32).briton.BritonConfig.BatchSchedulerPolicyH\x00\x88\x01\x01\x12\x1f\n\x12\x65nable_trt_overlap\x18\x06 \x01(\x08H\x01\x88\x01\x01\x12)\n\x1cmax_tokens_in_paged_kv_cache\x18\n \x01(\x04H\x02\x88\x01\x01\x12+\n\x1ekv_cache_free_gpu_mem_fraction\x18\x0b \x01(\x02H\x03\x88\x01\x01\x12!\n\x14medusa_decoding_mode\x18\x0c \x01(\x08H\x04\x88\x01\x01"D\n\x14\x42\x61tchSchedulerPolicy\x12\x13\n\x0fMAX_UTILIZATION\x10\x00\x12\x17\n\x13GUARANTEED_NO_EVICT\x10\x01\x42\x19\n\x17_batch_scheduler_policyB\x15\n\x13_enable_trt_overlapB\x1f\n\x1d_max_tokens_in_paged_kv_cacheB!\n\x1f_kv_cache_free_gpu_mem_fractionB\x17\n\x15_medusa_decoding_mode2L\n\x06\x42riton\x12\x42\n\x05Infer\x12\x18.briton.InferenceRequest\x1a\x1b.briton.InferenceAnswerPart"\x00\x30\x01\x62\x06proto3'
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
_globals = globals()
|
|
24
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
25
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "briton_pb2", _globals)
|
|
26
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
27
|
+
DESCRIPTOR._loaded_options = None
|
|
28
|
+
_globals["_INFERENCEREQUEST"]._serialized_start = 25
|
|
29
|
+
_globals["_INFERENCEREQUEST"]._serialized_end = 585
|
|
30
|
+
_globals["_INFERENCEANSWERPART"]._serialized_start = 587
|
|
31
|
+
_globals["_INFERENCEANSWERPART"]._serialized_end = 669
|
|
32
|
+
_globals["_BRITONCONFIG"]._serialized_start = 672
|
|
33
|
+
_globals["_BRITONCONFIG"]._serialized_end = 1178
|
|
34
|
+
_globals["_BRITONCONFIG_BATCHSCHEDULERPOLICY"]._serialized_start = 967
|
|
35
|
+
_globals["_BRITONCONFIG_BATCHSCHEDULERPOLICY"]._serialized_end = 1035
|
|
36
|
+
_globals["_BRITON"]._serialized_start = 1180
|
|
37
|
+
_globals["_BRITON"]._serialized_end = 1256
|
|
38
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
# type: ignore
|
|
3
|
+
|
|
4
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
5
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
6
|
+
import warnings
|
|
7
|
+
|
|
8
|
+
import briton_pb2 as briton__pb2
|
|
9
|
+
import grpc
|
|
10
|
+
|
|
11
|
+
GRPC_GENERATED_VERSION = "1.63.0"
|
|
12
|
+
GRPC_VERSION = grpc.__version__
|
|
13
|
+
EXPECTED_ERROR_RELEASE = "1.65.0"
|
|
14
|
+
SCHEDULED_RELEASE_DATE = "June 25, 2024"
|
|
15
|
+
_version_not_supported = False
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
from grpc._utilities import first_version_is_lower
|
|
19
|
+
|
|
20
|
+
_version_not_supported = first_version_is_lower(
|
|
21
|
+
GRPC_VERSION, GRPC_GENERATED_VERSION
|
|
22
|
+
)
|
|
23
|
+
except ImportError:
|
|
24
|
+
_version_not_supported = True
|
|
25
|
+
|
|
26
|
+
if _version_not_supported:
|
|
27
|
+
warnings.warn(
|
|
28
|
+
f"The grpc package installed is at version {GRPC_VERSION},"
|
|
29
|
+
+ f" but the generated code in briton_pb2_grpc.py depends on"
|
|
30
|
+
+ f" grpcio>={GRPC_GENERATED_VERSION}."
|
|
31
|
+
+ f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}"
|
|
32
|
+
+ f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}."
|
|
33
|
+
+ f" This warning will become an error in {EXPECTED_ERROR_RELEASE},"
|
|
34
|
+
+ f" scheduled for release on {SCHEDULED_RELEASE_DATE}.",
|
|
35
|
+
RuntimeWarning,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class BritonStub(object):
|
|
40
|
+
"""The greeting service definition."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, channel):
|
|
43
|
+
"""Constructor.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
channel: A grpc.Channel.
|
|
47
|
+
"""
|
|
48
|
+
self.Infer = channel.unary_stream(
|
|
49
|
+
"/briton.Briton/Infer",
|
|
50
|
+
request_serializer=briton__pb2.InferenceRequest.SerializeToString,
|
|
51
|
+
response_deserializer=briton__pb2.InferenceAnswerPart.FromString,
|
|
52
|
+
_registered_method=True,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class BritonServicer(object):
|
|
57
|
+
"""The greeting service definition."""
|
|
58
|
+
|
|
59
|
+
def Infer(self, request, context):
|
|
60
|
+
"""Sends a greeting"""
|
|
61
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
62
|
+
context.set_details("Method not implemented!")
|
|
63
|
+
raise NotImplementedError("Method not implemented!")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def add_BritonServicer_to_server(servicer, server):
|
|
67
|
+
rpc_method_handlers = {
|
|
68
|
+
"Infer": grpc.unary_stream_rpc_method_handler(
|
|
69
|
+
servicer.Infer,
|
|
70
|
+
request_deserializer=briton__pb2.InferenceRequest.FromString,
|
|
71
|
+
response_serializer=briton__pb2.InferenceAnswerPart.SerializeToString,
|
|
72
|
+
),
|
|
73
|
+
}
|
|
74
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
75
|
+
"briton.Briton", rpc_method_handlers
|
|
76
|
+
)
|
|
77
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# This class is part of an EXPERIMENTAL API.
|
|
81
|
+
class Briton(object):
|
|
82
|
+
"""The greeting service definition."""
|
|
83
|
+
|
|
84
|
+
@staticmethod
|
|
85
|
+
def Infer(
|
|
86
|
+
request,
|
|
87
|
+
target,
|
|
88
|
+
options=(),
|
|
89
|
+
channel_credentials=None,
|
|
90
|
+
call_credentials=None,
|
|
91
|
+
insecure=False,
|
|
92
|
+
compression=None,
|
|
93
|
+
wait_for_ready=None,
|
|
94
|
+
timeout=None,
|
|
95
|
+
metadata=None,
|
|
96
|
+
):
|
|
97
|
+
return grpc.experimental.unary_stream(
|
|
98
|
+
request,
|
|
99
|
+
target,
|
|
100
|
+
"/briton.Briton/Infer",
|
|
101
|
+
briton__pb2.InferenceRequest.SerializeToString,
|
|
102
|
+
briton__pb2.InferenceAnswerPart.FromString,
|
|
103
|
+
options,
|
|
104
|
+
channel_credentials,
|
|
105
|
+
insecure,
|
|
106
|
+
call_credentials,
|
|
107
|
+
compression,
|
|
108
|
+
wait_for_ready,
|
|
109
|
+
timeout,
|
|
110
|
+
metadata,
|
|
111
|
+
_registered_method=True,
|
|
112
|
+
)
|
|
File without changes
|
|
@@ -315,29 +315,57 @@ def test_empty_config():
|
|
|
315
315
|
|
|
316
316
|
|
|
317
317
|
def test_from_yaml():
|
|
318
|
-
yaml_path = Path("test.yaml")
|
|
319
318
|
data = {"description": "this is a test"}
|
|
320
|
-
with
|
|
319
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as yaml_file:
|
|
320
|
+
yaml_path = Path(yaml_file.name)
|
|
321
321
|
yaml.safe_dump(data, yaml_file)
|
|
322
322
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
assert result.description == "this is a test"
|
|
323
|
+
result = TrussConfig.from_yaml(yaml_path)
|
|
326
324
|
|
|
327
|
-
|
|
325
|
+
assert result.description == "this is a test"
|
|
328
326
|
|
|
329
327
|
|
|
330
328
|
def test_from_yaml_empty():
|
|
331
|
-
yaml_path = Path("test.yaml")
|
|
332
329
|
data = {}
|
|
333
|
-
with
|
|
330
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as yaml_file:
|
|
331
|
+
yaml_path = Path(yaml_file.name)
|
|
334
332
|
yaml.safe_dump(data, yaml_file)
|
|
335
333
|
|
|
336
|
-
|
|
334
|
+
result = TrussConfig.from_yaml(yaml_path)
|
|
335
|
+
|
|
336
|
+
# test some attributes (should be default)
|
|
337
|
+
assert result.description is None
|
|
338
|
+
assert result.spec_version == "2.0"
|
|
339
|
+
assert result.bundled_packages_dir == "packages"
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def test_from_yaml_secrets_as_list():
|
|
343
|
+
data = {"description": "this is a test", "secrets": ["foo", "bar"]}
|
|
344
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as yaml_file:
|
|
345
|
+
yaml_path = Path(yaml_file.name)
|
|
346
|
+
yaml.safe_dump(data, yaml_file)
|
|
347
|
+
|
|
348
|
+
with pytest.raises(ValueError):
|
|
349
|
+
TrussConfig.from_yaml(yaml_path)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def test_from_yaml_python_version():
|
|
353
|
+
yaml_path = Path("test.yaml")
|
|
354
|
+
invalid_py_version_data = {
|
|
355
|
+
"description": "this is a test",
|
|
356
|
+
"python_version": "py38",
|
|
357
|
+
}
|
|
358
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as yaml_file:
|
|
359
|
+
yaml_path = Path(yaml_file.name)
|
|
360
|
+
yaml.safe_dump(invalid_py_version_data, yaml_file)
|
|
361
|
+
|
|
362
|
+
with pytest.raises(ValueError):
|
|
363
|
+
TrussConfig.from_yaml(yaml_path)
|
|
337
364
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
365
|
+
valid_py_version_data = {"description": "this is a test", "python_version": "py39"}
|
|
366
|
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as yaml_file:
|
|
367
|
+
yaml_path = Path(yaml_file.name)
|
|
368
|
+
yaml.safe_dump(valid_py_version_data, yaml_file)
|
|
342
369
|
|
|
343
|
-
|
|
370
|
+
result = TrussConfig.from_yaml(yaml_path)
|
|
371
|
+
result.python_version == "py39"
|
|
@@ -39,6 +39,8 @@ DEFAULT_USE_GPU = False
|
|
|
39
39
|
|
|
40
40
|
DEFAULT_BLOB_BACKEND = HTTP_PUBLIC_BLOB_BACKEND
|
|
41
41
|
|
|
42
|
+
VALID_PYTHON_VERSIONS = ["py39", "py310", "py311"]
|
|
43
|
+
|
|
42
44
|
# Set up logging
|
|
43
45
|
logging.basicConfig(level=logging.INFO)
|
|
44
46
|
logger = logging.getLogger(__name__)
|
|
@@ -576,6 +578,21 @@ class TrussConfig:
|
|
|
576
578
|
return TrussConfig.from_dict(self.to_dict())
|
|
577
579
|
|
|
578
580
|
def validate(self):
|
|
581
|
+
if self.python_version not in VALID_PYTHON_VERSIONS:
|
|
582
|
+
|
|
583
|
+
raise ValueError(
|
|
584
|
+
f"Please ensure that `python_version` is one of {VALID_PYTHON_VERSIONS}"
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
if not isinstance(self.secrets, dict):
|
|
588
|
+
raise ValueError(
|
|
589
|
+
"Please ensure that `secrets` is a mapping of the form:\n"
|
|
590
|
+
"```\n"
|
|
591
|
+
"secrets:\n"
|
|
592
|
+
' secret1: "some default value"\n'
|
|
593
|
+
' secret2: "some other default value"\n'
|
|
594
|
+
"```"
|
|
595
|
+
)
|
|
579
596
|
for secret_name in self.secrets:
|
|
580
597
|
validate_secret_name(secret_name)
|
|
581
598
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import re
|
|
2
|
-
from pathlib import
|
|
2
|
+
from pathlib import PosixPath
|
|
3
3
|
from typing import Pattern, Set
|
|
4
4
|
|
|
5
5
|
from truss.constants import REGISTRY_BUILD_SECRET_PREFIX
|
|
@@ -81,9 +81,10 @@ def _is_numeric(number_like: str) -> bool:
|
|
|
81
81
|
def validate_python_executable_path(path: str) -> None:
|
|
82
82
|
"""
|
|
83
83
|
This python executable path determines the python executable
|
|
84
|
-
used to run the inference server - check to see that it is an absolute path
|
|
84
|
+
used to run the inference server - check to see that it is an absolute path.
|
|
85
|
+
We use PosixPath -- TrussServer always runs on a Posix machine.
|
|
85
86
|
"""
|
|
86
|
-
if path and not
|
|
87
|
+
if path and not PosixPath(path).is_absolute():
|
|
87
88
|
raise ValidationError(
|
|
88
89
|
f"Invalid relative python executable path {path}. Provide an absolute path"
|
|
89
90
|
)
|
|
@@ -23,10 +23,10 @@ from truss_chains.definitions import (
|
|
|
23
23
|
)
|
|
24
24
|
from truss_chains.public_api import (
|
|
25
25
|
ChainletBase,
|
|
26
|
+
depends,
|
|
27
|
+
depends_context,
|
|
26
28
|
deploy_remotely,
|
|
27
29
|
entrypoint,
|
|
28
|
-
provide,
|
|
29
|
-
provide_context,
|
|
30
30
|
run_local,
|
|
31
31
|
)
|
|
32
32
|
from truss_chains.stub import StubBase
|