tributo 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tributo/__init__.py +157 -0
- tributo/_bootstrap.py +92 -0
- tributo/_common/__init__.py +40 -0
- tributo/_common/algorithm_distribution.py +1382 -0
- tributo/_common/config.py +22 -0
- tributo/_common/dag.py +93 -0
- tributo/_common/dependencies.py +237 -0
- tributo/_common/immutable.py +153 -0
- tributo/_common/logging.py +108 -0
- tributo/_common/model_input_contract.py +121 -0
- tributo/_common/registry.py +186 -0
- tributo/_common/retry.py +68 -0
- tributo/_common/runtime_env.py +236 -0
- tributo/_common/serve_utils.py +188 -0
- tributo/_common/storage.py +310 -0
- tributo/_common/storage_profiles.py +108 -0
- tributo/_common/submission_id.py +37 -0
- tributo/_common/version_compatibility.py +23 -0
- tributo/algorithms/__init__.py +243 -0
- tributo/algorithms/api/__init__.py +227 -0
- tributo/algorithms/api/artifacts.py +515 -0
- tributo/algorithms/api/context.py +167 -0
- tributo/algorithms/api/descriptor.py +117 -0
- tributo/algorithms/api/distribution.py +1548 -0
- tributo/algorithms/api/errors.py +44 -0
- tributo/algorithms/api/execution.py +1316 -0
- tributo/algorithms/api/graph.py +574 -0
- tributo/algorithms/api/models.py +2005 -0
- tributo/algorithms/api/support.py +352 -0
- tributo/algorithms/api/torch_runtime.py +1355 -0
- tributo/algorithms/builtin/__init__.py +8 -0
- tributo/algorithms/composition.py +82 -0
- tributo/algorithms/conformance.py +211 -0
- tributo/algorithms/conformance_cli.py +48 -0
- tributo/algorithms/core/__init__.py +27 -0
- tributo/algorithms/core/builder.py +787 -0
- tributo/algorithms/core/contracts.py +75 -0
- tributo/algorithms/core/dispatcher.py +576 -0
- tributo/algorithms/core/lifecycle.py +56 -0
- tributo/algorithms/core/planner.py +409 -0
- tributo/algorithms/core/registry.py +238 -0
- tributo/algorithms/core/runtime.py +316 -0
- tributo/algorithms/core/worker.py +321 -0
- tributo/algorithms/input/__init__.py +18 -0
- tributo/algorithms/input/fake.py +242 -0
- tributo/algorithms/input/tabular.py +54 -0
- tributo/algorithms/spi/__init__.py +99 -0
- tributo/algorithms/spi/contracts.py +23 -0
- tributo/algorithms/spi/execution.py +426 -0
- tributo/algorithms/spi/input.py +389 -0
- tributo/algorithms/spi/torch.py +613 -0
- tributo/cli.py +1921 -0
- tributo/cli_broker.py +72 -0
- tributo/config.py +204 -0
- tributo/data/__init__.py +250 -0
- tributo/data/_s3.py +381 -0
- tributo/data/_source_paths.py +87 -0
- tributo/data/base.py +11 -0
- tributo/data/binding_plugins.py +72 -0
- tributo/data/bindings/__init__.py +761 -0
- tributo/data/bindings/_daft_sql.py +177 -0
- tributo/data/bindings/_postgresql.py +93 -0
- tributo/data/bindings/_shared.py +209 -0
- tributo/data/bindings/_sql_shared.py +88 -0
- tributo/data/bindings/daft_csv.py +111 -0
- tributo/data/bindings/daft_doris.py +5 -0
- tributo/data/bindings/daft_iceberg.py +143 -0
- tributo/data/bindings/daft_lance.py +134 -0
- tributo/data/bindings/daft_parquet.py +119 -0
- tributo/data/bindings/daft_postgresql.py +122 -0
- tributo/data/bindings/ray_clickhouse.py +176 -0
- tributo/data/bindings/ray_csv.py +119 -0
- tributo/data/bindings/ray_doris.py +165 -0
- tributo/data/bindings/ray_hdfs.py +177 -0
- tributo/data/bindings/ray_hive.py +138 -0
- tributo/data/bindings/ray_iceberg.py +203 -0
- tributo/data/bindings/ray_lance.py +161 -0
- tributo/data/bindings/ray_parquet.py +131 -0
- tributo/data/bindings/ray_postgresql.py +118 -0
- tributo/data/contracts/__init__.py +17 -0
- tributo/data/contracts/handles.py +33 -0
- tributo/data/contracts/modes.py +17 -0
- tributo/data/contracts/storage.py +39 -0
- tributo/data/engine_binding.py +1024 -0
- tributo/data/engine_ids.py +26 -0
- tributo/data/graph.py +222 -0
- tributo/data/handle_adapters.py +104 -0
- tributo/data/ingestion.py +784 -0
- tributo/data/persistence/__init__.py +34 -0
- tributo/data/persistence/checkpoint.py +84 -0
- tributo/data/persistence/lance.py +121 -0
- tributo/data/persistence/object_store.py +236 -0
- tributo/data/persistence/parquet.py +101 -0
- tributo/data/provider.py +258 -0
- tributo/data/provider_builtins.py +1541 -0
- tributo/data/provider_plugins.py +162 -0
- tributo/data/provider_registry.py +355 -0
- tributo/data/refs.py +385 -0
- tributo/data/runtime_credentials.py +72 -0
- tributo/data/scan_plan.py +918 -0
- tributo/data/source_config.py +764 -0
- tributo/data/transform_compiler.py +469 -0
- tributo/data/transform_ir.py +386 -0
- tributo/data/writing/__init__.py +47 -0
- tributo/data/writing/_native.py +202 -0
- tributo/data/writing/bindings.py +39 -0
- tributo/data/writing/builtins.py +93 -0
- tributo/data/writing/capabilities.py +40 -0
- tributo/data/writing/contracts.py +356 -0
- tributo/data/writing/gateway.py +160 -0
- tributo/data/writing/native_bindings.py +661 -0
- tributo/data/writing/plugins.py +73 -0
- tributo/data/writing/policy.py +33 -0
- tributo/data/writing/registry.py +151 -0
- tributo/data/writing/target_registry.py +64 -0
- tributo/data/writing/targets.py +104 -0
- tributo/exceptions.py +250 -0
- tributo/explainability/__init__.py +44 -0
- tributo/explainability/batch_job.py +55 -0
- tributo/explainability/conformance.py +38 -0
- tributo/explainability/contracts.py +437 -0
- tributo/explainability/executor.py +698 -0
- tributo/explainability/export.py +24 -0
- tributo/explainability/job_runner.py +57 -0
- tributo/explainability/planner.py +119 -0
- tributo/explainability/protocols.py +286 -0
- tributo/explainability/reference.py +67 -0
- tributo/explainability/registry.py +90 -0
- tributo/explainability/shap.py +417 -0
- tributo/exporting/__init__.py +167 -0
- tributo/exporting/assembler.py +227 -0
- tributo/exporting/bundle_reader.py +284 -0
- tributo/exporting/capabilities.py +275 -0
- tributo/exporting/conftest.py +308 -0
- tributo/exporting/dispatch.py +335 -0
- tributo/exporting/errors.py +24 -0
- tributo/exporting/events.py +118 -0
- tributo/exporting/executor.py +420 -0
- tributo/exporting/formats.py +27 -0
- tributo/exporting/gc.py +60 -0
- tributo/exporting/hooks.py +231 -0
- tributo/exporting/manifest.py +552 -0
- tributo/exporting/models.py +931 -0
- tributo/exporting/options.py +38 -0
- tributo/exporting/planner.py +344 -0
- tributo/exporting/protocols.py +183 -0
- tributo/exporting/publisher.py +156 -0
- tributo/exporting/records.py +488 -0
- tributo/exporting/registries.py +563 -0
- tributo/exporting/repository.py +355 -0
- tributo/exporting/runtime.py +1019 -0
- tributo/exporting/service.py +517 -0
- tributo/exporting/validators.py +119 -0
- tributo/inference/__init__.py +104 -0
- tributo/inference/_credential_safety.py +141 -0
- tributo/inference/api.py +135 -0
- tributo/inference/base.py +95 -0
- tributo/inference/batch_job.py +96 -0
- tributo/inference/batch_predictor.py +379 -0
- tributo/inference/bundle_predictor.py +41 -0
- tributo/inference/contracts.py +740 -0
- tributo/inference/executor.py +332 -0
- tributo/inference/importers.py +17 -0
- tributo/inference/input_resolver.py +246 -0
- tributo/inference/job_runner.py +509 -0
- tributo/inference/kernel.py +258 -0
- tributo/inference/pipeline.py +678 -0
- tributo/inference/post_training.py +137 -0
- tributo/inference/resolver.py +264 -0
- tributo/integrations/__init__.py +5 -0
- tributo/integrations/algorithm_inputs/__init__.py +26 -0
- tributo/integrations/algorithm_inputs/ingestion.py +759 -0
- tributo/integrations/algorithm_runtimes/__init__.py +3 -0
- tributo/integrations/algorithm_runtimes/collective.py +421 -0
- tributo/integrations/algorithm_runtimes/decomposition.py +245 -0
- tributo/integrations/algorithm_runtimes/framework_native.py +559 -0
- tributo/integrations/algorithm_runtimes/graph_partition.py +608 -0
- tributo/integrations/algorithm_runtimes/iterative_optimization.py +639 -0
- tributo/integrations/algorithm_runtimes/joblib_estimator.py +330 -0
- tributo/integrations/algorithm_runtimes/legacy_descriptors.py +78 -0
- tributo/integrations/algorithm_runtimes/legacy_trainer.py +192 -0
- tributo/integrations/algorithm_runtimes/map_reduce.py +608 -0
- tributo/integrations/algorithm_runtimes/parallel_ensemble.py +521 -0
- tributo/integrations/algorithm_runtimes/portable_metrics.py +61 -0
- tributo/integrations/algorithm_runtimes/ray_data_config.py +89 -0
- tributo/integrations/algorithm_runtimes/ray_function.py +83 -0
- tributo/integrations/algorithm_runtimes/ray_task.py +120 -0
- tributo/integrations/algorithm_runtimes/ray_train_torch.py +2710 -0
- tributo/integrations/algorithm_runtimes/sklearn.py +327 -0
- tributo/integrations/broker.py +170 -0
- tributo/integrations/broker_registry.py +99 -0
- tributo/integrations/exporters/__init__.py +1 -0
- tributo/integrations/exporters/hf_onnx.py +257 -0
- tributo/integrations/exporters/onnx_quantizer.py +161 -0
- tributo/integrations/exporters/options.py +63 -0
- tributo/integrations/exporters/prebuilt_onnx.py +88 -0
- tributo/integrations/exporters/torch_export.py +254 -0
- tributo/integrations/exporters/torch_onnx.py +455 -0
- tributo/integrations/exporters/torch_safetensors.py +221 -0
- tributo/integrations/flavors/__init__.py +8 -0
- tributo/integrations/flavors/onnx_runtime.py +166 -0
- tributo/integrations/hooks/__init__.py +1 -0
- tributo/integrations/hooks/mlflow_hook.py +363 -0
- tributo/integrations/model_importers/__init__.py +25 -0
- tributo/integrations/model_importers/_bundle.py +241 -0
- tributo/integrations/model_importers/artifact.py +276 -0
- tributo/integrations/model_importers/mlflow.py +525 -0
- tributo/integrations/model_importers/registry.py +96 -0
- tributo/integrations/model_runtimes/__init__.py +51 -0
- tributo/integrations/model_runtimes/bundle.py +50 -0
- tributo/integrations/model_runtimes/explainability.py +644 -0
- tributo/integrations/model_runtimes/resolver.py +181 -0
- tributo/integrations/sinks/__init__.py +42 -0
- tributo/integrations/sinks/data_write.py +96 -0
- tributo/integrations/sinks/explainability.py +96 -0
- tributo/integrations/sinks/lance.py +344 -0
- tributo/integrations/sinks/legacy.py +72 -0
- tributo/integrations/sinks/parquet.py +181 -0
- tributo/integrations/sinks/registry.py +136 -0
- tributo/integrations/sources/__init__.py +7 -0
- tributo/integrations/sources/huggingface.py +125 -0
- tributo/integrations/sources/ray_torch.py +523 -0
- tributo/integrations/storage/__init__.py +3 -0
- tributo/integrations/storage/bundle_repository.py +1717 -0
- tributo/integrations/storage/gc.py +292 -0
- tributo/integrations/storage/json_operation_store.py +308 -0
- tributo/integrations/validators/__init__.py +1 -0
- tributo/integrations/validators/onnx_runtime.py +132 -0
- tributo/job.py +279 -0
- tributo/kuberay_submission.py +932 -0
- tributo/kuberay_xgboost_gate.py +259 -0
- tributo/plugin.py +1162 -0
- tributo/py.typed +0 -0
- tributo/ray_jobs.py +290 -0
- tributo/registry/__init__.py +18 -0
- tributo/registry/callback.py +160 -0
- tributo/registry/mlflow_util.py +259 -0
- tributo/registry/model_registry.py +305 -0
- tributo/registry/schema.py +45 -0
- tributo/runtime.py +293 -0
- tributo/runtime_providers.py +418 -0
- tributo/serving/__init__.py +81 -0
- tributo/serving/composition.py +190 -0
- tributo/serving/grpc_deployment.py +726 -0
- tributo/serving/grpc_runner.py +116 -0
- tributo/serving/identity_predictor.py +473 -0
- tributo/serving/model_deployment.py +338 -0
- tributo/serving/observability.py +177 -0
- tributo/serving/proto/compile.sh +31 -0
- tributo/serving/proto/inference.proto +66 -0
- tributo/serving/proto/inference_pb2.py +42 -0
- tributo/serving/proto/inference_pb2_grpc.py +189 -0
- tributo/serving/schema.py +197 -0
- tributo/serving/serve_runner.py +115 -0
- tributo/serving/streaming_deployment.py +371 -0
- tributo/serving/streaming_runner.py +100 -0
- tributo/training/__init__.py +158 -0
- tributo/training/algorithm_spec.py +480 -0
- tributo/training/base.py +291 -0
- tributo/training/callbacks.py +85 -0
- tributo/training/catalog.py +462 -0
- tributo/training/causal_estimator.py +288 -0
- tributo/training/checkpoint.py +433 -0
- tributo/training/config.py +265 -0
- tributo/training/data_loader.py +147 -0
- tributo/training/distributed_torch.py +209 -0
- tributo/training/exporters/__init__.py +85 -0
- tributo/training/exporters/artifact_protocol.py +79 -0
- tributo/training/exporters/causal_report.py +102 -0
- tributo/training/exporters/safetensors.py +98 -0
- tributo/training/exporters/torch_onnx_exporter.py +209 -0
- tributo/training/exporters/torchscript.py +107 -0
- tributo/training/features/__init__.py +13 -0
- tributo/training/features/column_types.py +204 -0
- tributo/training/features/dataset.py +156 -0
- tributo/training/features/transformer.py +328 -0
- tributo/training/flavor.py +113 -0
- tributo/training/graph_trainer.py +93 -0
- tributo/training/job_submitter.py +514 -0
- tributo/training/lifecycle.py +496 -0
- tributo/training/local_runner.py +137 -0
- tributo/training/losses/__init__.py +10 -0
- tributo/training/losses/focal_loss.py +137 -0
- tributo/training/models/__init__.py +5 -0
- tributo/training/portable_tune.py +255 -0
- tributo/training/registry.py +508 -0
- tributo/training/resource.py +477 -0
- tributo/training/results.py +124 -0
- tributo/training/support_snapshot.py +163 -0
- tributo/training/tune_config.py +97 -0
- tributo/training/tune_runner.py +888 -0
- tributo/training/tune_space.py +441 -0
- tributo/util/__init__.py +23 -0
- tributo/util/annotations.py +145 -0
- tributo/vector_index/__init__.py +51 -0
- tributo/vector_index/cli.py +139 -0
- tributo/vector_index/contracts.py +564 -0
- tributo/vector_index/errors.py +40 -0
- tributo/vector_index/index_job.py +146 -0
- tributo/vector_index/job.py +263 -0
- tributo/vector_index/lance_ray_adapter.py +601 -0
- tributo/vector_index/maintenance.py +144 -0
- tributo/vector_index/result_writer.py +115 -0
- tributo/vector_index/search.py +101 -0
- tributo-1.1.0.dist-info/METADATA +484 -0
- tributo-1.1.0.dist-info/RECORD +309 -0
- tributo-1.1.0.dist-info/WHEEL +4 -0
- tributo-1.1.0.dist-info/entry_points.txt +33 -0
- tributo-1.1.0.dist-info/licenses/LICENSE +202 -0
tributo/__init__.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""Ray-native machine learning control-plane APIs.
|
|
2
|
+
|
|
3
|
+
The root package exposes the stable Ray Jobs client, job configuration, and
|
|
4
|
+
shared exception hierarchy. Component APIs live in packages such as
|
|
5
|
+
``tributo.data``, ``tributo.algorithms``, ``tributo.exporting``,
|
|
6
|
+
``tributo.inference``, and ``tributo.vector_index``.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import PackageNotFoundError
|
|
12
|
+
from importlib.metadata import version as _get_version
|
|
13
|
+
from typing import TYPE_CHECKING, Any, Final
|
|
14
|
+
|
|
15
|
+
_version_str: str
|
|
16
|
+
try:
|
|
17
|
+
_version_str = _get_version("tributo")
|
|
18
|
+
except PackageNotFoundError:
|
|
19
|
+
_version_str = "1.1.0"
|
|
20
|
+
__version__: Final[str] = _version_str
|
|
21
|
+
|
|
22
|
+
from tributo.config import JobConfig # noqa: E402
|
|
23
|
+
from tributo.exceptions import ( # noqa: E402
|
|
24
|
+
DataSourceError,
|
|
25
|
+
JobConfigurationError,
|
|
26
|
+
JobExecutionError,
|
|
27
|
+
JobSubmissionError,
|
|
28
|
+
JobTimeoutError,
|
|
29
|
+
ModelExportError,
|
|
30
|
+
TributoError,
|
|
31
|
+
)
|
|
32
|
+
from tributo.runtime import (
|
|
33
|
+
RuntimeExecutionMode,
|
|
34
|
+
RuntimeLifecycle,
|
|
35
|
+
RuntimeSubmissionMode,
|
|
36
|
+
RuntimeTarget,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
if TYPE_CHECKING:
|
|
40
|
+
from tributo.job import RayJob, TributoClient
|
|
41
|
+
from tributo.kuberay_submission import (
|
|
42
|
+
KubeRayDeploymentConfig,
|
|
43
|
+
KubeRayJobRequest,
|
|
44
|
+
KubeRayJobStatus,
|
|
45
|
+
KubeRayJobSubmission,
|
|
46
|
+
KubeRayJobSubmitter,
|
|
47
|
+
KubeRayResourceProfile,
|
|
48
|
+
KubeRayWorkerResources,
|
|
49
|
+
build_kuberay_rayjob_manifest,
|
|
50
|
+
)
|
|
51
|
+
from tributo.runtime_providers import (
|
|
52
|
+
LocalRayJobsProvider,
|
|
53
|
+
RuntimeLease,
|
|
54
|
+
RuntimeProvider,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
_LAZY_EXPORTS = {
|
|
58
|
+
"RayJob": ("tributo.job", "RayJob"),
|
|
59
|
+
"TributoClient": ("tributo.job", "TributoClient"),
|
|
60
|
+
"LocalRayJobsProvider": ("tributo.runtime_providers", "LocalRayJobsProvider"),
|
|
61
|
+
"RuntimeLease": ("tributo.runtime_providers", "RuntimeLease"),
|
|
62
|
+
"RuntimeProvider": ("tributo.runtime_providers", "RuntimeProvider"),
|
|
63
|
+
"open_job_submission_client": (
|
|
64
|
+
"tributo.runtime_providers",
|
|
65
|
+
"open_job_submission_client",
|
|
66
|
+
),
|
|
67
|
+
"open_ray_client": ("tributo.runtime_providers", "open_ray_client"),
|
|
68
|
+
"register_runtime_provider": (
|
|
69
|
+
"tributo.runtime_providers",
|
|
70
|
+
"register_runtime_provider",
|
|
71
|
+
),
|
|
72
|
+
"resolve_runtime_provider": (
|
|
73
|
+
"tributo.runtime_providers",
|
|
74
|
+
"resolve_runtime_provider",
|
|
75
|
+
),
|
|
76
|
+
"run_local_entrypoint": ("tributo.runtime_providers", "run_local_entrypoint"),
|
|
77
|
+
"KubeRayDeploymentConfig": (
|
|
78
|
+
"tributo.kuberay_submission",
|
|
79
|
+
"KubeRayDeploymentConfig",
|
|
80
|
+
),
|
|
81
|
+
"KubeRayJobRequest": ("tributo.kuberay_submission", "KubeRayJobRequest"),
|
|
82
|
+
"KubeRayJobStatus": ("tributo.kuberay_submission", "KubeRayJobStatus"),
|
|
83
|
+
"KubeRayJobSubmission": (
|
|
84
|
+
"tributo.kuberay_submission",
|
|
85
|
+
"KubeRayJobSubmission",
|
|
86
|
+
),
|
|
87
|
+
"KubeRayJobSubmitter": (
|
|
88
|
+
"tributo.kuberay_submission",
|
|
89
|
+
"KubeRayJobSubmitter",
|
|
90
|
+
),
|
|
91
|
+
"KubeRayResourceProfile": (
|
|
92
|
+
"tributo.kuberay_submission",
|
|
93
|
+
"KubeRayResourceProfile",
|
|
94
|
+
),
|
|
95
|
+
"KubeRayWorkerResources": (
|
|
96
|
+
"tributo.kuberay_submission",
|
|
97
|
+
"KubeRayWorkerResources",
|
|
98
|
+
),
|
|
99
|
+
"build_kuberay_rayjob_manifest": (
|
|
100
|
+
"tributo.kuberay_submission",
|
|
101
|
+
"build_kuberay_rayjob_manifest",
|
|
102
|
+
),
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def __getattr__(name: str) -> Any:
|
|
107
|
+
"""Load Ray Jobs integrations only when a caller requests them."""
|
|
108
|
+
try:
|
|
109
|
+
module_name, attribute = _LAZY_EXPORTS[name]
|
|
110
|
+
except KeyError as exc:
|
|
111
|
+
raise AttributeError(f"module 'tributo' has no attribute {name!r}") from exc
|
|
112
|
+
import importlib
|
|
113
|
+
|
|
114
|
+
value = getattr(importlib.import_module(module_name), attribute)
|
|
115
|
+
globals()[name] = value
|
|
116
|
+
return value
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def __dir__() -> list[str]:
|
|
120
|
+
"""Expose stable lazy root symbols to interactive callers."""
|
|
121
|
+
return sorted({*globals(), *__all__})
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
__all__: list[str] = [
|
|
125
|
+
# Core
|
|
126
|
+
"TributoClient",
|
|
127
|
+
"RayJob",
|
|
128
|
+
"JobConfig",
|
|
129
|
+
"RuntimeTarget",
|
|
130
|
+
"RuntimeExecutionMode",
|
|
131
|
+
"RuntimeSubmissionMode",
|
|
132
|
+
"RuntimeLifecycle",
|
|
133
|
+
"RuntimeLease",
|
|
134
|
+
"LocalRayJobsProvider",
|
|
135
|
+
"RuntimeProvider",
|
|
136
|
+
"open_job_submission_client",
|
|
137
|
+
"open_ray_client",
|
|
138
|
+
"register_runtime_provider",
|
|
139
|
+
"resolve_runtime_provider",
|
|
140
|
+
"run_local_entrypoint",
|
|
141
|
+
"KubeRayDeploymentConfig",
|
|
142
|
+
"KubeRayJobRequest",
|
|
143
|
+
"KubeRayJobStatus",
|
|
144
|
+
"KubeRayJobSubmission",
|
|
145
|
+
"KubeRayJobSubmitter",
|
|
146
|
+
"KubeRayResourceProfile",
|
|
147
|
+
"KubeRayWorkerResources",
|
|
148
|
+
"build_kuberay_rayjob_manifest",
|
|
149
|
+
# Exceptions
|
|
150
|
+
"TributoError",
|
|
151
|
+
"JobSubmissionError",
|
|
152
|
+
"JobExecutionError",
|
|
153
|
+
"JobConfigurationError",
|
|
154
|
+
"JobTimeoutError",
|
|
155
|
+
"ModelExportError",
|
|
156
|
+
"DataSourceError",
|
|
157
|
+
]
|
tributo/_bootstrap.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Internal composition roots for first-party integrations."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from tributo._common.storage_profiles import StorageProfileResolver
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from tributo.exporting.gc import BundleGarbageCollectorBackend
|
|
11
|
+
from tributo.exporting.protocols import (
|
|
12
|
+
ExportSourceProvider,
|
|
13
|
+
ExportValidator,
|
|
14
|
+
ModelExporter,
|
|
15
|
+
)
|
|
16
|
+
from tributo.exporting.repository import BundleAliasStore, BundleRepository
|
|
17
|
+
from tributo.exporting.runtime import BundleModelFlavor
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def first_party_export_plugins() -> tuple[
|
|
21
|
+
tuple[type[ModelExporter], ...], tuple[type[ExportValidator], ...]
|
|
22
|
+
]:
|
|
23
|
+
"""Return built-in exporters and validators without entry-point metadata."""
|
|
24
|
+
from tributo.integrations.exporters.hf_onnx import HuggingFaceONNXExporter
|
|
25
|
+
from tributo.integrations.exporters.onnx_quantizer import ONNXQuantizer
|
|
26
|
+
from tributo.integrations.exporters.torch_export import TorchExportExporter
|
|
27
|
+
from tributo.integrations.exporters.torch_onnx import TorchONNXExporter
|
|
28
|
+
from tributo.integrations.exporters.torch_safetensors import (
|
|
29
|
+
TorchSafetensorsExporter,
|
|
30
|
+
)
|
|
31
|
+
from tributo.integrations.validators.onnx_runtime import ONNXRuntimeValidator
|
|
32
|
+
|
|
33
|
+
exporters: tuple[type[ModelExporter], ...] = (
|
|
34
|
+
TorchSafetensorsExporter,
|
|
35
|
+
TorchONNXExporter,
|
|
36
|
+
TorchExportExporter,
|
|
37
|
+
HuggingFaceONNXExporter,
|
|
38
|
+
ONNXQuantizer,
|
|
39
|
+
)
|
|
40
|
+
validators: tuple[type[ExportValidator], ...] = (ONNXRuntimeValidator,)
|
|
41
|
+
return exporters, validators
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def first_party_source_providers() -> tuple[type[ExportSourceProvider], ...]:
|
|
45
|
+
"""Return built-in checkpoint providers without entry-point metadata."""
|
|
46
|
+
from tributo.integrations.sources.ray_torch import RayTorchSourceProvider
|
|
47
|
+
|
|
48
|
+
return (RayTorchSourceProvider,)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def first_party_model_flavors() -> tuple[type[BundleModelFlavor], ...]:
|
|
52
|
+
"""Return built-in executable flavors without entry-point metadata."""
|
|
53
|
+
from tributo.integrations.flavors.onnx_runtime import ONNXRuntimeFlavor
|
|
54
|
+
|
|
55
|
+
return (ONNXRuntimeFlavor,)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def first_party_bundle_storage_adapters(
|
|
59
|
+
storage_resolver: StorageProfileResolver | None,
|
|
60
|
+
) -> tuple[tuple[BundleRepository, ...], tuple[BundleAliasStore, ...]]:
|
|
61
|
+
"""Construct built-in storage adapters without distribution metadata.
|
|
62
|
+
|
|
63
|
+
Ray ``runtime_env.py_modules`` and source-only deployments replace Python
|
|
64
|
+
modules but not the installed package's entry-point metadata. The
|
|
65
|
+
internal composition root therefore owns first-party construction;
|
|
66
|
+
entry points remain the extension mechanism for third-party adapters.
|
|
67
|
+
"""
|
|
68
|
+
from tributo.integrations.storage.bundle_repository import (
|
|
69
|
+
LocalBundleAliasStore,
|
|
70
|
+
LocalBundleRepository,
|
|
71
|
+
S3BundleAliasStore,
|
|
72
|
+
S3BundleRepository,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
repositories: tuple[BundleRepository, ...] = (
|
|
76
|
+
LocalBundleRepository(storage_resolver),
|
|
77
|
+
S3BundleRepository(storage_resolver),
|
|
78
|
+
)
|
|
79
|
+
alias_stores: tuple[BundleAliasStore, ...] = (
|
|
80
|
+
LocalBundleAliasStore(storage_resolver),
|
|
81
|
+
S3BundleAliasStore(storage_resolver),
|
|
82
|
+
)
|
|
83
|
+
return repositories, alias_stores
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def first_party_bundle_garbage_collector(
|
|
87
|
+
storage_resolver: StorageProfileResolver | None,
|
|
88
|
+
) -> BundleGarbageCollectorBackend:
|
|
89
|
+
"""Construct the first-party bundle-maintenance adapter."""
|
|
90
|
+
from tributo.integrations.storage.gc import S3BundleGarbageCollector
|
|
91
|
+
|
|
92
|
+
return S3BundleGarbageCollector(storage_resolver)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Common utilities shared across Tributo.
|
|
2
|
+
|
|
3
|
+
This module contains shared utilities at the developer API level.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
|
|
10
|
+
from tributo._common.logging import configure_logging
|
|
11
|
+
from tributo._common.runtime_env import (
|
|
12
|
+
build_runtime_env,
|
|
13
|
+
find_project_root,
|
|
14
|
+
)
|
|
15
|
+
from tributo._common.storage import (
|
|
16
|
+
download_from_s3,
|
|
17
|
+
get_boto3_client,
|
|
18
|
+
get_boto3_client_from_config,
|
|
19
|
+
parse_s3_url,
|
|
20
|
+
resolve_to_local,
|
|
21
|
+
upload_file,
|
|
22
|
+
write_bytes,
|
|
23
|
+
write_json,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
DEFAULT_DASHBOARD_URL = os.environ.get("DEFAULT_DASHBOARD_URL", "http://127.0.0.1:8265")
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"build_runtime_env",
|
|
30
|
+
"configure_logging",
|
|
31
|
+
"download_from_s3",
|
|
32
|
+
"find_project_root",
|
|
33
|
+
"get_boto3_client",
|
|
34
|
+
"get_boto3_client_from_config",
|
|
35
|
+
"parse_s3_url",
|
|
36
|
+
"resolve_to_local",
|
|
37
|
+
"upload_file",
|
|
38
|
+
"write_bytes",
|
|
39
|
+
"write_json",
|
|
40
|
+
]
|