autogluon.cloud 0.5.0__tar.gz → 0.7.0__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.
- {autogluon_cloud-0.5.0/src/autogluon.cloud.egg-info → autogluon_cloud-0.7.0}/PKG-INFO +42 -72
- autogluon_cloud-0.7.0/README.md +82 -0
- autogluon_cloud-0.7.0/pyproject.toml +106 -0
- autogluon_cloud-0.7.0/setup.py +33 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/__init__.py +6 -10
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/backend.py +54 -36
- autogluon_cloud-0.7.0/src/autogluon/cloud/backend/backend_factory.py +25 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/constant.py +1 -4
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/multimodal_sagemaker_backend.py +61 -83
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/sagemaker_backend.py +550 -551
- autogluon_cloud-0.7.0/src/autogluon/cloud/backend/tabular_sagemaker_backend.py +67 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/timeseries_sagemaker_backend.py +50 -54
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/cli.py +29 -18
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/cloud_setup.py +66 -70
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/config.py +4 -11
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/data/format_converter.py +6 -7
- autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint/endpoint.py +48 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint/multimodal_endpoint.py +129 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint/prediction_future.py +72 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint/tabular_endpoint.py +180 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint/timeseries_endpoint.py +115 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/job/remote_job.py +5 -6
- autogluon_cloud-0.7.0/src/autogluon/cloud/job/sagemaker_job.py +299 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/model/foundation_model.py +1061 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/model/registry.py +191 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/predictor/cloud_predictor.py +948 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/predictor/multimodal_cloud_predictor.py +172 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/predictor/tabular_cloud_predictor.py +274 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/predictor/timeseries_cloud_predictor.py +444 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/scripts/sagemaker_scripts/serving_utils/mitra.py +24 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/serving_utils/timeseries.py +4 -4
- autogluon_cloud-0.7.0/src/autogluon/cloud/scripts/sagemaker_scripts/tabular_fm_serve.py +120 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/tabular_serve.py +21 -17
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/timeseries_fm_serve.py +3 -2
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/timeseries_serve.py +31 -3
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/train.py +52 -17
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/script_manager.py +2 -4
- autogluon_cloud-0.7.0/src/autogluon/cloud/templates/ag_cloud_sagemaker.yaml +132 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/__init__.py +1 -1
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/ag_sagemaker.py +124 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/autogluon_dlc.json +90 -28
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/aws_utils.py +118 -21
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/constants.py +16 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/deserializers.py +28 -19
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/dlc_utils.py +183 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/job_logs.py +98 -0
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/misc.py +33 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/s3_utils.py +7 -9
- autogluon_cloud-0.7.0/src/autogluon/cloud/utils/sagemaker_api.py +184 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/serializers.py +40 -31
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/tag_utils.py +3 -4
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/utils/utils.py +42 -6
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/version.py +1 -1
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0/src/autogluon.cloud.egg-info}/PKG-INFO +42 -72
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon.cloud.egg-info/SOURCES.txt +6 -20
- autogluon_cloud-0.7.0/src/autogluon.cloud.egg-info/requires.txt +18 -0
- autogluon_cloud-0.5.0/README.md +0 -93
- autogluon_cloud-0.5.0/pyproject.toml +0 -37
- autogluon_cloud-0.5.0/setup.py +0 -158
- autogluon_cloud-0.5.0/src/autogluon/cloud/backend/backend_factory.py +0 -39
- autogluon_cloud-0.5.0/src/autogluon/cloud/backend/ray_aws_backend.py +0 -94
- autogluon_cloud-0.5.0/src/autogluon/cloud/backend/ray_backend.py +0 -508
- autogluon_cloud-0.5.0/src/autogluon/cloud/backend/tabular_sagemaker_backend.py +0 -6
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/__init__.py +0 -6
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/cluster_config_generator.py +0 -80
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/cluster_manager.py +0 -54
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/constants.py +0 -20
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/ray_aws_cluster_config_generator.py +0 -247
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/ray_aws_cluster_manager.py +0 -11
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/ray_cluster_config_generator.py +0 -7
- autogluon_cloud-0.5.0/src/autogluon/cloud/cluster/ray_cluster_manager.py +0 -105
- autogluon_cloud-0.5.0/src/autogluon/cloud/default_cluster_configs/ray_aws_default_cluster_config.yaml +0 -47
- autogluon_cloud-0.5.0/src/autogluon/cloud/endpoint/endpoint.py +0 -26
- autogluon_cloud-0.5.0/src/autogluon/cloud/endpoint/prediction_future.py +0 -52
- autogluon_cloud-0.5.0/src/autogluon/cloud/endpoint/sagemaker_endpoint.py +0 -47
- autogluon_cloud-0.5.0/src/autogluon/cloud/endpoint/timeseries_endpoint.py +0 -112
- autogluon_cloud-0.5.0/src/autogluon/cloud/job/ray_job.py +0 -177
- autogluon_cloud-0.5.0/src/autogluon/cloud/job/sagemaker_job.py +0 -352
- autogluon_cloud-0.5.0/src/autogluon/cloud/model/foundation_model.py +0 -705
- autogluon_cloud-0.5.0/src/autogluon/cloud/model/registry.py +0 -56
- autogluon_cloud-0.5.0/src/autogluon/cloud/predictor/cloud_predictor.py +0 -835
- autogluon_cloud-0.5.0/src/autogluon/cloud/predictor/multimodal_cloud_predictor.py +0 -30
- autogluon_cloud-0.5.0/src/autogluon/cloud/predictor/tabular_cloud_predictor.py +0 -30
- autogluon_cloud-0.5.0/src/autogluon/cloud/predictor/timeseries_cloud_predictor.py +0 -451
- autogluon_cloud-0.5.0/src/autogluon/cloud/scripts/ray_scripts/train.py +0 -124
- autogluon_cloud-0.5.0/src/autogluon/cloud/scripts/sagemaker_scripts/__init__.py +0 -0
- autogluon_cloud-0.5.0/src/autogluon/cloud/scripts/sagemaker_scripts/serving_utils/__init__.py +0 -0
- autogluon_cloud-0.5.0/src/autogluon/cloud/templates/ag_cloud_ray_aws.yaml +0 -128
- autogluon_cloud-0.5.0/src/autogluon/cloud/templates/ag_cloud_sagemaker.yaml +0 -58
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/ag_sagemaker.py +0 -246
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/constants.py +0 -11
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/dlc_utils.py +0 -110
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/ec2.py +0 -103
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/iam.py +0 -129
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/misc.py +0 -14
- autogluon_cloud-0.5.0/src/autogluon/cloud/utils/ray_aws_iam.py +0 -106
- autogluon_cloud-0.5.0/src/autogluon.cloud.egg-info/requires.txt +0 -25
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/LICENSE +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/NOTICE +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/setup.cfg +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/backend/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/data/__init__.py +0 -0
- {autogluon_cloud-0.5.0/src/autogluon/cloud/default_cluster_configs → autogluon_cloud-0.7.0/src/autogluon/cloud/endpoint}/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/job/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/model/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/predictor/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/__init__.py +0 -0
- {autogluon_cloud-0.5.0/src/autogluon/cloud/endpoint → autogluon_cloud-0.7.0/src/autogluon/cloud/scripts/sagemaker_scripts}/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon/cloud/scripts/sagemaker_scripts/multimodal_serve.py +0 -0
- {autogluon_cloud-0.5.0/src/autogluon/cloud/scripts/ray_scripts → autogluon_cloud-0.7.0/src/autogluon/cloud/scripts/sagemaker_scripts/serving_utils}/__init__.py +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon.cloud.egg-info/dependency_links.txt +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon.cloud.egg-info/entry_points.txt +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon.cloud.egg-info/top_level.txt +0 -0
- {autogluon_cloud-0.5.0 → autogluon_cloud-0.7.0}/src/autogluon.cloud.egg-info/zip-safe +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: autogluon.cloud
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Train and deploy
|
|
5
|
-
Home-page: https://github.com/autogluon/autogluon-cloud
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Train and deploy ML models in the cloud
|
|
6
5
|
Author: AutoGluon Community
|
|
7
|
-
License: Apache-2.0
|
|
8
|
-
Project-URL: Documentation, https://auto.gluon.ai
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Documentation, https://auto.gluon.ai/cloud
|
|
9
8
|
Project-URL: Bug Reports, https://github.com/autogluon/autogluon-cloud/issues
|
|
10
9
|
Project-URL: Source, https://github.com/autogluon/autogluon-cloud/
|
|
11
10
|
Project-URL: Contribute!, https://github.com/autogluon/autogluon-cloud/blob/master/CONTRIBUTING.md
|
|
@@ -17,7 +16,6 @@ Classifier: Intended Audience :: Customer Service
|
|
|
17
16
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
18
17
|
Classifier: Intended Audience :: Healthcare Industry
|
|
19
18
|
Classifier: Intended Audience :: Telecommunications Industry
|
|
20
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
21
19
|
Classifier: Operating System :: MacOS
|
|
22
20
|
Classifier: Operating System :: Microsoft :: Windows
|
|
23
21
|
Classifier: Operating System :: POSIX
|
|
@@ -31,44 +29,27 @@ Classifier: Topic :: Software Development
|
|
|
31
29
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
32
30
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
33
31
|
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
34
|
-
Requires-Python:
|
|
32
|
+
Requires-Python: <3.14,>=3.10
|
|
35
33
|
Description-Content-Type: text/markdown
|
|
36
34
|
License-File: LICENSE
|
|
37
35
|
License-File: NOTICE
|
|
38
|
-
Requires-Dist: autogluon.common<1.
|
|
39
|
-
Requires-Dist: boto3<2,>=1.
|
|
36
|
+
Requires-Dist: autogluon.common<1.7,>=0.7
|
|
37
|
+
Requires-Dist: boto3<2,>=1.37.23
|
|
40
38
|
Requires-Dist: packaging<27,>=23.0
|
|
41
|
-
Requires-Dist: sagemaker<3,>=2.126.0
|
|
42
39
|
Requires-Dist: pyarrow<25,>=19.0.1
|
|
43
40
|
Requires-Dist: PyYAML~=6.0
|
|
44
41
|
Requires-Dist: Pillow<13,>=10.2
|
|
45
42
|
Requires-Dist: huggingface_hub<2,>=0.20
|
|
46
|
-
Requires-Dist: typing_extensions<5,>=4.
|
|
43
|
+
Requires-Dist: typing_extensions<5,>=4.5
|
|
47
44
|
Requires-Dist: click<9,>=8.0
|
|
48
45
|
Requires-Dist: rich<15,>=13.0
|
|
49
|
-
Provides-Extra: ray
|
|
50
|
-
Requires-Dist: ray[default]<2.56,>=2.10.0; extra == "ray"
|
|
51
46
|
Provides-Extra: all
|
|
52
|
-
Requires-Dist: autogluon<1.
|
|
53
|
-
Requires-Dist: ray[default]<2.56,>=2.10.0; extra == "all"
|
|
47
|
+
Requires-Dist: autogluon<1.7,>=0.7; extra == "all"
|
|
54
48
|
Provides-Extra: tests
|
|
55
|
-
Requires-Dist: moto; extra == "tests"
|
|
56
49
|
Requires-Dist: pytest; extra == "tests"
|
|
50
|
+
Requires-Dist: moto; extra == "tests"
|
|
57
51
|
Requires-Dist: autogluon.common>=0.7; extra == "tests"
|
|
58
|
-
Requires-Dist: pytest-cov; extra == "tests"
|
|
59
|
-
Requires-Dist: tox; extra == "tests"
|
|
60
|
-
Dynamic: author
|
|
61
|
-
Dynamic: classifier
|
|
62
|
-
Dynamic: description
|
|
63
|
-
Dynamic: description-content-type
|
|
64
|
-
Dynamic: home-page
|
|
65
|
-
Dynamic: license
|
|
66
52
|
Dynamic: license-file
|
|
67
|
-
Dynamic: project-url
|
|
68
|
-
Dynamic: provides-extra
|
|
69
|
-
Dynamic: requires-dist
|
|
70
|
-
Dynamic: requires-python
|
|
71
|
-
Dynamic: summary
|
|
72
53
|
|
|
73
54
|
|
|
74
55
|
|
|
@@ -78,7 +59,7 @@ Dynamic: summary
|
|
|
78
59
|
## Train and Deploy AutoGluon in the Cloud
|
|
79
60
|
|
|
80
61
|
[](https://pypi.org/project/autogluon.cloud/)
|
|
81
|
-
[](https://pypi.org/project/autogluon.cloud/)
|
|
62
|
+
[](https://pypi.org/project/autogluon.cloud/)
|
|
82
63
|
[](./LICENSE)
|
|
83
64
|
[](https://github.com/autogluon/autogluon-cloud/actions/workflows/continuous_integration.yml)
|
|
84
65
|
|
|
@@ -86,30 +67,48 @@ Dynamic: summary
|
|
|
86
67
|
|
|
87
68
|
</div>
|
|
88
69
|
|
|
89
|
-
AutoGluon-Cloud lets you train and deploy state-of-the-art ML models
|
|
70
|
+
AutoGluon-Cloud lets you train and deploy state-of-the-art ML models for classification, regression, and time series forecasting on [Amazon SageMaker](https://aws.amazon.com/sagemaker/). All it takes is a few lines of code; AutoGluon-Cloud handles the infrastructure, dependencies, and glue code for you.
|
|
71
|
+
|
|
72
|
+
## 💡 Why AutoGluon-Cloud?
|
|
90
73
|
|
|
91
|
-
- **
|
|
92
|
-
- **
|
|
74
|
+
- **Works like local [AutoGluon](https://auto.gluon.ai/stable/index.html).** Pass in DataFrames, get predictions back — as convenient as working locally, with the compute handled by AWS.
|
|
75
|
+
- **No boilerplate.** No training scripts, inference handlers, or serialization code to write and maintain.
|
|
76
|
+
- **Official AWS containers.** Everything runs in the [AutoGluon Deep Learning Containers](https://aws.github.io/deep-learning-containers/), maintained and security-patched by AWS.
|
|
77
|
+
- **Sensible defaults, fully configurable.** Under the hood it's just SageMaker running in your AWS account, so you stay in full control.
|
|
93
78
|
|
|
94
|
-
## 💾 Installation
|
|
79
|
+
## 💾 Installation
|
|
95
80
|
|
|
96
81
|
```bash
|
|
97
82
|
pip install autogluon.cloud
|
|
83
|
+
autogluon-cloud bootstrap # one-time setup for IAM role and S3 bucket
|
|
98
84
|
```
|
|
99
85
|
|
|
100
|
-
|
|
86
|
+
See the [Setup tutorial](https://auto.gluon.ai/cloud/stable/tutorials/setup.html) for more details.
|
|
87
|
+
|
|
88
|
+
## 🚀 Foundation models
|
|
89
|
+
|
|
90
|
+
Zero-shot forecasts with a pretrained model like [Chronos-2](https://huggingface.co/amazon/chronos-2) — no training required. [Full walkthrough](https://auto.gluon.ai/cloud/stable/tutorials/foundation-model-timeseries.html).
|
|
101
91
|
|
|
102
92
|
```python
|
|
103
|
-
from autogluon.cloud import
|
|
93
|
+
from autogluon.cloud import TimeSeriesFoundationModel
|
|
104
94
|
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
# `data` can be a local path, S3 URL, or pandas DataFrame
|
|
96
|
+
data = "https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly_tiny/train.csv"
|
|
107
97
|
|
|
108
|
-
|
|
98
|
+
model = TimeSeriesFoundationModel("chronos-2")
|
|
99
|
+
|
|
100
|
+
# Batch prediction
|
|
101
|
+
predictions = model.predict(data=data, target="target", prediction_length=24)
|
|
102
|
+
|
|
103
|
+
# Real-time inference endpoint
|
|
104
|
+
endpoint = model.deploy()
|
|
105
|
+
predictions = endpoint.predict(data=data, target="target", prediction_length=24)
|
|
106
|
+
endpoint.delete_endpoint()
|
|
107
|
+
```
|
|
109
108
|
|
|
110
|
-
## ⚙️ Train your own
|
|
109
|
+
## ⚙️ Train your own predictor
|
|
111
110
|
|
|
112
|
-
Train an AutoGluon predictor on your data and serve it from
|
|
111
|
+
Train an AutoGluon predictor on your data and serve it from SageMaker. Full walkthrough: [time series](https://auto.gluon.ai/cloud/stable/tutorials/predictor-timeseries.html), [tabular](https://auto.gluon.ai/cloud/stable/tutorials/predictor-tabular.html).
|
|
113
112
|
|
|
114
113
|
```python
|
|
115
114
|
from autogluon.cloud import TabularCloudPredictor
|
|
@@ -126,40 +125,11 @@ cloud_predictor.fit(
|
|
|
126
125
|
predictor_fit_args={"time_limit": 120}, # passed to TabularPredictor.fit()
|
|
127
126
|
)
|
|
128
127
|
|
|
129
|
-
# Real-time inference endpoint
|
|
130
|
-
cloud_predictor.deploy()
|
|
131
|
-
result = cloud_predictor.predict_real_time(test_data)
|
|
132
|
-
cloud_predictor.cleanup_deployment()
|
|
133
|
-
|
|
134
128
|
# Batch prediction
|
|
135
129
|
result = cloud_predictor.predict(test_data)
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## 🚀 Run a pretrained foundation model
|
|
139
|
-
|
|
140
|
-
Skip training entirely — deploy a pretrained model like Chronos-2 to SageMaker and get zero-shot predictions out of the box. Full walkthrough: [time series](https://auto.gluon.ai/cloud/stable/tutorials/foundation-model-timeseries.html).
|
|
141
|
-
|
|
142
|
-
```python
|
|
143
|
-
from autogluon.cloud import TimeSeriesFoundationModel
|
|
144
|
-
|
|
145
|
-
# `data` can be a local path, S3 URL, or pandas DataFrame
|
|
146
|
-
data = "https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly_tiny/train.csv"
|
|
147
|
-
|
|
148
|
-
model = TimeSeriesFoundationModel("chronos-2")
|
|
149
|
-
|
|
150
|
-
# Batch prediction — no training required
|
|
151
|
-
predictions = model.predict(
|
|
152
|
-
data=data,
|
|
153
|
-
target="target",
|
|
154
|
-
prediction_length=24,
|
|
155
|
-
)
|
|
156
130
|
|
|
157
131
|
# Real-time inference endpoint
|
|
158
|
-
endpoint =
|
|
159
|
-
|
|
160
|
-
data=data,
|
|
161
|
-
target="target",
|
|
162
|
-
prediction_length=24,
|
|
163
|
-
)
|
|
132
|
+
endpoint = cloud_predictor.deploy()
|
|
133
|
+
result = endpoint.predict(test_data)
|
|
164
134
|
endpoint.delete_endpoint()
|
|
165
135
|
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://user-images.githubusercontent.com/16392542/77208906-224aa500-6aba-11ea-96bd-e81806074030.png" width="350">
|
|
5
|
+
|
|
6
|
+
## Train and Deploy AutoGluon in the Cloud
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/autogluon.cloud/)
|
|
9
|
+
[](https://pypi.org/project/autogluon.cloud/)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
[](https://github.com/autogluon/autogluon-cloud/actions/workflows/continuous_integration.yml)
|
|
12
|
+
|
|
13
|
+
[AutoGluon-Cloud Documentation](https://auto.gluon.ai/cloud/stable/index.html) | [AutoGluon Documentation](https://auto.gluon.ai)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
AutoGluon-Cloud lets you train and deploy state-of-the-art ML models for classification, regression, and time series forecasting on [Amazon SageMaker](https://aws.amazon.com/sagemaker/). All it takes is a few lines of code; AutoGluon-Cloud handles the infrastructure, dependencies, and glue code for you.
|
|
18
|
+
|
|
19
|
+
## 💡 Why AutoGluon-Cloud?
|
|
20
|
+
|
|
21
|
+
- **Works like local [AutoGluon](https://auto.gluon.ai/stable/index.html).** Pass in DataFrames, get predictions back — as convenient as working locally, with the compute handled by AWS.
|
|
22
|
+
- **No boilerplate.** No training scripts, inference handlers, or serialization code to write and maintain.
|
|
23
|
+
- **Official AWS containers.** Everything runs in the [AutoGluon Deep Learning Containers](https://aws.github.io/deep-learning-containers/), maintained and security-patched by AWS.
|
|
24
|
+
- **Sensible defaults, fully configurable.** Under the hood it's just SageMaker running in your AWS account, so you stay in full control.
|
|
25
|
+
|
|
26
|
+
## 💾 Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install autogluon.cloud
|
|
30
|
+
autogluon-cloud bootstrap # one-time setup for IAM role and S3 bucket
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See the [Setup tutorial](https://auto.gluon.ai/cloud/stable/tutorials/setup.html) for more details.
|
|
34
|
+
|
|
35
|
+
## 🚀 Foundation models
|
|
36
|
+
|
|
37
|
+
Zero-shot forecasts with a pretrained model like [Chronos-2](https://huggingface.co/amazon/chronos-2) — no training required. [Full walkthrough](https://auto.gluon.ai/cloud/stable/tutorials/foundation-model-timeseries.html).
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from autogluon.cloud import TimeSeriesFoundationModel
|
|
41
|
+
|
|
42
|
+
# `data` can be a local path, S3 URL, or pandas DataFrame
|
|
43
|
+
data = "https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly_tiny/train.csv"
|
|
44
|
+
|
|
45
|
+
model = TimeSeriesFoundationModel("chronos-2")
|
|
46
|
+
|
|
47
|
+
# Batch prediction
|
|
48
|
+
predictions = model.predict(data=data, target="target", prediction_length=24)
|
|
49
|
+
|
|
50
|
+
# Real-time inference endpoint
|
|
51
|
+
endpoint = model.deploy()
|
|
52
|
+
predictions = endpoint.predict(data=data, target="target", prediction_length=24)
|
|
53
|
+
endpoint.delete_endpoint()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## ⚙️ Train your own predictor
|
|
57
|
+
|
|
58
|
+
Train an AutoGluon predictor on your data and serve it from SageMaker. Full walkthrough: [time series](https://auto.gluon.ai/cloud/stable/tutorials/predictor-timeseries.html), [tabular](https://auto.gluon.ai/cloud/stable/tutorials/predictor-tabular.html).
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from autogluon.cloud import TabularCloudPredictor
|
|
62
|
+
|
|
63
|
+
# `train_data` and `test_data` can be a local path, S3 URL, or pandas DataFrame
|
|
64
|
+
train_data = "https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv"
|
|
65
|
+
test_data = "https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv"
|
|
66
|
+
|
|
67
|
+
# Train
|
|
68
|
+
cloud_predictor = TabularCloudPredictor()
|
|
69
|
+
cloud_predictor.fit(
|
|
70
|
+
train_data=train_data,
|
|
71
|
+
predictor_init_args={"label": "class"}, # passed to TabularPredictor()
|
|
72
|
+
predictor_fit_args={"time_limit": 120}, # passed to TabularPredictor.fit()
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Batch prediction
|
|
76
|
+
result = cloud_predictor.predict(test_data)
|
|
77
|
+
|
|
78
|
+
# Real-time inference endpoint
|
|
79
|
+
endpoint = cloud_predictor.deploy()
|
|
80
|
+
result = endpoint.predict(test_data)
|
|
81
|
+
endpoint.delete_endpoint()
|
|
82
|
+
```
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"] # >=77 for PEP 639 SPDX license expression support
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "autogluon.cloud"
|
|
7
|
+
description = "Train and deploy ML models in the cloud"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10,<3.14"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
12
|
+
authors = [{ name = "AutoGluon Community" }]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Education",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Intended Audience :: Customer Service",
|
|
19
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
20
|
+
"Intended Audience :: Healthcare Industry",
|
|
21
|
+
"Intended Audience :: Telecommunications Industry",
|
|
22
|
+
"Operating System :: MacOS",
|
|
23
|
+
"Operating System :: Microsoft :: Windows",
|
|
24
|
+
"Operating System :: POSIX",
|
|
25
|
+
"Operating System :: Unix",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Topic :: Software Development",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
34
|
+
"Topic :: Scientific/Engineering :: Image Recognition",
|
|
35
|
+
]
|
|
36
|
+
# version stays dynamic and is owned by setup.py (so the RELEASE=1 -> clean
|
|
37
|
+
# version, else .dev0 logic keeps working).
|
|
38
|
+
dynamic = ["version"]
|
|
39
|
+
dependencies = [
|
|
40
|
+
# common module provides utils with stable api across minor version
|
|
41
|
+
"autogluon.common>=0.7,<1.7",
|
|
42
|
+
# <2 because unlikely to introduce breaking changes in minor releases.
|
|
43
|
+
# TransformAmiVersion was added to the SageMaker service model in botocore 1.37.23.
|
|
44
|
+
"boto3>=1.37.23,<2",
|
|
45
|
+
"packaging>=23.0,<27",
|
|
46
|
+
"pyarrow>=19.0.1,<25", # lower bound to avoid https://github.com/apache/arrow/issues/45283
|
|
47
|
+
"PyYAML~=6.0",
|
|
48
|
+
"Pillow>=10.2,<13",
|
|
49
|
+
"huggingface_hub>=0.20,<2",
|
|
50
|
+
"typing_extensions>=4.5,<5", # 4.5 adds @deprecated (PEP 702)
|
|
51
|
+
# CLI dependencies (autogluon-cloud command)
|
|
52
|
+
"click>=8.0,<9",
|
|
53
|
+
"rich>=13.0,<15",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.optional-dependencies]
|
|
57
|
+
all = [ # To allow user to pass ag objects
|
|
58
|
+
"autogluon>=0.7,<1.7",
|
|
59
|
+
]
|
|
60
|
+
tests = [
|
|
61
|
+
"pytest",
|
|
62
|
+
"moto",
|
|
63
|
+
"autogluon.common>=0.7",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[project.urls]
|
|
67
|
+
Documentation = "https://auto.gluon.ai/cloud"
|
|
68
|
+
"Bug Reports" = "https://github.com/autogluon/autogluon-cloud/issues"
|
|
69
|
+
Source = "https://github.com/autogluon/autogluon-cloud/"
|
|
70
|
+
"Contribute!" = "https://github.com/autogluon/autogluon-cloud/blob/master/CONTRIBUTING.md"
|
|
71
|
+
|
|
72
|
+
[project.scripts]
|
|
73
|
+
autogluon-cloud = "autogluon.cloud.cli:main"
|
|
74
|
+
|
|
75
|
+
[tool.setuptools]
|
|
76
|
+
zip-safe = true
|
|
77
|
+
include-package-data = true
|
|
78
|
+
|
|
79
|
+
[tool.setuptools.packages.find]
|
|
80
|
+
where = ["src"]
|
|
81
|
+
namespaces = true
|
|
82
|
+
|
|
83
|
+
[tool.setuptools.package-data]
|
|
84
|
+
"autogluon.cloud" = [
|
|
85
|
+
"utils/autogluon_dlc.json",
|
|
86
|
+
"templates/*.yaml",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[tool.ruff]
|
|
90
|
+
line-length = 119
|
|
91
|
+
target-version = "py310"
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
select = ["E", "F", "I", "W"]
|
|
95
|
+
ignore = ["E501"]
|
|
96
|
+
per-file-ignores = {"*/__init__.py" = ["F401"]}
|
|
97
|
+
|
|
98
|
+
[tool.ruff.lint.isort]
|
|
99
|
+
known-first-party = ["autogluon"]
|
|
100
|
+
|
|
101
|
+
[tool.pytest.ini_options]
|
|
102
|
+
testpaths = ["tests"]
|
|
103
|
+
# Release tests are slow and expensive; run them with `-m release` (see .github/workflows/release_tests.yml).
|
|
104
|
+
addopts = "--strict-markers -m 'not release'"
|
|
105
|
+
markers = ["release: pre-release test that runs every registry model on its default instance"]
|
|
106
|
+
xfail_strict = true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from setuptools import setup
|
|
4
|
+
|
|
5
|
+
AUTOGLUON = "autogluon"
|
|
6
|
+
CLOUD = "cloud"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_version_file(*, version):
|
|
10
|
+
print("-- Building version " + version)
|
|
11
|
+
version_path = os.path.join("src", AUTOGLUON, CLOUD, "version.py")
|
|
12
|
+
with open(version_path, "w") as f:
|
|
13
|
+
f.write(f'"""This is the {AUTOGLUON}.{CLOUD} version file."""\n')
|
|
14
|
+
f.write("__version__ = '{}'\n".format(version))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def update_version(version):
|
|
18
|
+
"""
|
|
19
|
+
To release a new stable version on PyPi, tag the release on github; the Github CI publishes it to PyPi
|
|
20
|
+
(see .github/workflows/pypi_release.yml, which sets RELEASE=1). Non-release builds get a `.dev0` suffix.
|
|
21
|
+
"""
|
|
22
|
+
if not os.getenv("RELEASE"):
|
|
23
|
+
version += ".dev0"
|
|
24
|
+
return version
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
version = "0.7.0"
|
|
28
|
+
version = update_version(version)
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
create_version_file(version=version)
|
|
32
|
+
# Everything except the dynamic version lives in pyproject.toml.
|
|
33
|
+
setup(version=version)
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
import sagemaker
|
|
4
|
-
from packaging.version import Version
|
|
5
|
-
|
|
6
|
-
if Version(sagemaker.__version__) >= Version("3.0"):
|
|
7
|
-
raise ImportError(
|
|
8
|
-
f"SageMaker SDK >= 3.0 is currently not supported (found {sagemaker.__version__}). "
|
|
9
|
-
"Please downgrade: pip install -U 'sagemaker<3'"
|
|
10
|
-
)
|
|
11
|
-
|
|
12
3
|
from autogluon.common.utils.log_utils import _add_stream_handler
|
|
13
4
|
|
|
14
5
|
from .cloud_setup import bootstrap, register, status, teardown
|
|
6
|
+
from .endpoint.multimodal_endpoint import MultiModalEndpoint
|
|
7
|
+
from .endpoint.tabular_endpoint import TabularEndpoint
|
|
15
8
|
from .endpoint.timeseries_endpoint import TimeSeriesEndpoint
|
|
16
|
-
from .model.foundation_model import TimeSeriesFoundationModel
|
|
9
|
+
from .model.foundation_model import TabularFoundationModel, TimeSeriesFoundationModel
|
|
17
10
|
from .predictor import MultiModalCloudPredictor, TabularCloudPredictor, TimeSeriesCloudPredictor
|
|
18
11
|
|
|
19
12
|
_add_stream_handler()
|
|
@@ -21,7 +14,10 @@ logging.getLogger(__name__).setLevel(logging.INFO)
|
|
|
21
14
|
|
|
22
15
|
__all__ = [
|
|
23
16
|
"MultiModalCloudPredictor",
|
|
17
|
+
"MultiModalEndpoint",
|
|
24
18
|
"TabularCloudPredictor",
|
|
19
|
+
"TabularEndpoint",
|
|
20
|
+
"TabularFoundationModel",
|
|
25
21
|
"TimeSeriesCloudPredictor",
|
|
26
22
|
"TimeSeriesEndpoint",
|
|
27
23
|
"TimeSeriesFoundationModel",
|
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import os
|
|
4
|
-
import pickle
|
|
5
5
|
from abc import ABC, abstractmethod
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
def dumps_ag_args(config: dict[str, Any]) -> str:
|
|
12
|
+
"""Serialize the remote-training config to JSON, raising a user-facing error on failure.
|
|
13
|
+
|
|
14
|
+
The config carries the user's predictor init/fit arguments. Some objects (search spaces,
|
|
15
|
+
custom metric objects, classes/callables in ``hyperparameters``) are not JSON-serializable;
|
|
16
|
+
when that happens we pinpoint the offending argument so the error names what the user passed.
|
|
17
|
+
"""
|
|
18
|
+
try:
|
|
19
|
+
return json.dumps(config)
|
|
20
|
+
except TypeError as e:
|
|
21
|
+
original_error = e
|
|
22
|
+
for group in ("predictor_init_args", "predictor_fit_args"):
|
|
23
|
+
for key, value in (config.get(group) or {}).items():
|
|
24
|
+
try:
|
|
25
|
+
json.dumps(value)
|
|
26
|
+
except TypeError as e:
|
|
27
|
+
raise TypeError(
|
|
28
|
+
f"The value passed for `{key}` is not JSON-serializable. This can happen with "
|
|
29
|
+
f"search spaces (Real/Categorical/Int), custom metric objects, or classes/callables "
|
|
30
|
+
f"in `hyperparameters`. Please pass these as plain values (e.g. metric names as strings). "
|
|
31
|
+
f"Original error: {e}"
|
|
32
|
+
) from e
|
|
33
|
+
# Culprit is outside the known arg groups; re-raise the original error with generic guidance.
|
|
34
|
+
raise TypeError(
|
|
35
|
+
f"The provided arguments are not JSON-serializable. Original error: {original_error}"
|
|
36
|
+
) from original_error
|
|
11
37
|
|
|
12
38
|
|
|
13
39
|
class Backend(ABC):
|
|
@@ -27,19 +53,20 @@ class Backend(ABC):
|
|
|
27
53
|
return self._cloud_output_path
|
|
28
54
|
|
|
29
55
|
def initialize(
|
|
30
|
-
self,
|
|
56
|
+
self,
|
|
57
|
+
local_output_path: str,
|
|
58
|
+
predictor_type: str,
|
|
59
|
+
cloud_output_path: str | None = None,
|
|
60
|
+
resource_prefix: str | None = None,
|
|
61
|
+
**kwargs,
|
|
31
62
|
) -> None:
|
|
32
63
|
"""Initialize the backend."""
|
|
33
64
|
self.local_output_path = local_output_path
|
|
34
65
|
self._cloud_output_path = cloud_output_path
|
|
35
66
|
self.predictor_type = predictor_type
|
|
67
|
+
self.resource_prefix = resource_prefix or f"ag-cloud-{predictor_type}"
|
|
36
68
|
self.original_features = None
|
|
37
|
-
self.
|
|
38
|
-
|
|
39
|
-
@abstractmethod
|
|
40
|
-
def parse_backend_fit_kwargs(self, kwargs: Dict) -> Dict[str, Any]:
|
|
41
|
-
"""Parse backend specific kwargs and get them ready to be sent to fit call"""
|
|
42
|
-
raise NotImplementedError
|
|
69
|
+
self.endpoint_name: str | None = None
|
|
43
70
|
|
|
44
71
|
@abstractmethod
|
|
45
72
|
def attach_job(self, job_name: str) -> None:
|
|
@@ -74,7 +101,7 @@ class Backend(ABC):
|
|
|
74
101
|
raise NotImplementedError
|
|
75
102
|
|
|
76
103
|
@abstractmethod
|
|
77
|
-
def get_fit_job_info(self) ->
|
|
104
|
+
def get_fit_job_info(self) -> dict[str, Any]:
|
|
78
105
|
"""
|
|
79
106
|
Get general info of the training job.
|
|
80
107
|
"""
|
|
@@ -83,18 +110,19 @@ class Backend(ABC):
|
|
|
83
110
|
def prepare_args(self, path: str, **kwargs):
|
|
84
111
|
"""
|
|
85
112
|
prepare parameter args required to be passed to remote AG, i.e. init args and fit args
|
|
86
|
-
The args will be saved as a
|
|
113
|
+
The args will be saved as a JSON file
|
|
87
114
|
|
|
88
115
|
Parameters
|
|
89
116
|
----------
|
|
90
117
|
path: str
|
|
91
|
-
Path to save the
|
|
118
|
+
Path to save the JSON file
|
|
92
119
|
"""
|
|
93
120
|
assert self.predictor_type is not None
|
|
94
121
|
config = self._construct_ag_args(**kwargs)
|
|
122
|
+
payload = dumps_ag_args(config)
|
|
95
123
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
96
|
-
with open(path, "
|
|
97
|
-
|
|
124
|
+
with open(path, "w") as f:
|
|
125
|
+
f.write(payload)
|
|
98
126
|
|
|
99
127
|
def _construct_ag_args(**kwargs):
|
|
100
128
|
raise NotImplementedError
|
|
@@ -104,11 +132,6 @@ class Backend(ABC):
|
|
|
104
132
|
"""Fit AG on the backend"""
|
|
105
133
|
raise NotImplementedError
|
|
106
134
|
|
|
107
|
-
@abstractmethod
|
|
108
|
-
def parse_backend_deploy_kwargs(self, kwargs: Dict) -> Dict[str, Any]:
|
|
109
|
-
"""Parse backend specific kwargs and get them ready to be sent to deploy call"""
|
|
110
|
-
raise NotImplementedError
|
|
111
|
-
|
|
112
135
|
@abstractmethod
|
|
113
136
|
def deploy(self, **kwargs) -> None:
|
|
114
137
|
"""Deploy and endpoint"""
|
|
@@ -120,32 +143,27 @@ class Backend(ABC):
|
|
|
120
143
|
raise NotImplementedError
|
|
121
144
|
|
|
122
145
|
@abstractmethod
|
|
123
|
-
def attach_endpoint(self, endpoint:
|
|
124
|
-
"""Attach the backend to an existing endpoint"""
|
|
146
|
+
def attach_endpoint(self, endpoint: str) -> None:
|
|
147
|
+
"""Attach the backend to an existing endpoint by name"""
|
|
125
148
|
raise NotImplementedError
|
|
126
149
|
|
|
127
150
|
@abstractmethod
|
|
128
|
-
def detach_endpoint(self) ->
|
|
129
|
-
"""Detach the current endpoint and return
|
|
151
|
+
def detach_endpoint(self) -> str:
|
|
152
|
+
"""Detach the current endpoint and return its name"""
|
|
130
153
|
raise NotImplementedError
|
|
131
154
|
|
|
132
155
|
@abstractmethod
|
|
133
|
-
def predict_real_time(self, test_data:
|
|
156
|
+
def predict_real_time(self, test_data: str | pd.DataFrame, **kwargs) -> pd.DataFrame | pd.Series:
|
|
134
157
|
"""Realtime prediction with the endpoint"""
|
|
135
158
|
raise NotImplementedError
|
|
136
159
|
|
|
137
160
|
@abstractmethod
|
|
138
|
-
def predict_proba_real_time(self, test_data:
|
|
161
|
+
def predict_proba_real_time(self, test_data: str | pd.DataFrame, **kwargs) -> pd.DataFrame | pd.Series:
|
|
139
162
|
"""Realtime prediction probability with the endpoint"""
|
|
140
163
|
raise NotImplementedError
|
|
141
164
|
|
|
142
165
|
@abstractmethod
|
|
143
|
-
def
|
|
144
|
-
"""Parse backend specific kwargs and get them ready to be sent to predict call"""
|
|
145
|
-
raise NotImplementedError
|
|
146
|
-
|
|
147
|
-
@abstractmethod
|
|
148
|
-
def get_batch_inference_job_info(self, job_name: Optional[str] = None) -> Dict[str, Any]:
|
|
166
|
+
def get_batch_inference_job_info(self, job_name: str | None = None) -> dict[str, Any]:
|
|
149
167
|
"""
|
|
150
168
|
Get general info of the batch inference job.
|
|
151
169
|
If job_name not specified, return the info of the most recent batch inference job
|
|
@@ -153,7 +171,7 @@ class Backend(ABC):
|
|
|
153
171
|
raise NotImplementedError
|
|
154
172
|
|
|
155
173
|
@abstractmethod
|
|
156
|
-
def get_batch_inference_job_status(self, job_name:
|
|
174
|
+
def get_batch_inference_job_status(self, job_name: str | None = None) -> str:
|
|
157
175
|
"""
|
|
158
176
|
Get general status of the batch inference job.
|
|
159
177
|
If job_name not specified, return the info of the most recent batch inference job
|
|
@@ -161,17 +179,17 @@ class Backend(ABC):
|
|
|
161
179
|
raise NotImplementedError
|
|
162
180
|
|
|
163
181
|
@abstractmethod
|
|
164
|
-
def get_batch_inference_jobs(self) ->
|
|
182
|
+
def get_batch_inference_jobs(self) -> list[str]:
|
|
165
183
|
"""Get a list of names of all batch inference jobs"""
|
|
166
184
|
raise NotImplementedError
|
|
167
185
|
|
|
168
186
|
@abstractmethod
|
|
169
|
-
def predict(self, test_data:
|
|
187
|
+
def predict(self, test_data: str | pd.DataFrame, **kwargs) -> pd.DataFrame | pd.Series:
|
|
170
188
|
"""Batch inference"""
|
|
171
189
|
raise NotImplementedError
|
|
172
190
|
|
|
173
191
|
@abstractmethod
|
|
174
|
-
def predict_proba(self, test_data:
|
|
192
|
+
def predict_proba(self, test_data: str | pd.DataFrame, **kwargs) -> pd.DataFrame | pd.Series:
|
|
175
193
|
"""Batch inference probability"""
|
|
176
194
|
raise NotImplementedError
|
|
177
195
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .backend import Backend
|
|
2
|
+
from .multimodal_sagemaker_backend import MultiModalSagemakerBackend
|
|
3
|
+
from .sagemaker_backend import SagemakerBackend
|
|
4
|
+
from .tabular_sagemaker_backend import TabularSagemakerBackend
|
|
5
|
+
from .timeseries_sagemaker_backend import TimeSeriesSagemakerBackend
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BackendFactory:
|
|
9
|
+
_BACKENDS = {
|
|
10
|
+
SagemakerBackend.name: SagemakerBackend,
|
|
11
|
+
TabularSagemakerBackend.name: TabularSagemakerBackend,
|
|
12
|
+
MultiModalSagemakerBackend.name: MultiModalSagemakerBackend,
|
|
13
|
+
TimeSeriesSagemakerBackend.name: TimeSeriesSagemakerBackend,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def get_backend_cls(backend: str) -> type[Backend]:
|
|
18
|
+
if backend in BackendFactory._BACKENDS:
|
|
19
|
+
return BackendFactory._BACKENDS[backend]
|
|
20
|
+
raise ValueError(f"{backend} not supported. Supported backends: {sorted(BackendFactory._BACKENDS)}")
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def get_backend(backend: str, **init_args) -> Backend:
|
|
24
|
+
"""Return the corresponding backend"""
|
|
25
|
+
return BackendFactory.get_backend_cls(backend)(**init_args)
|
|
@@ -2,9 +2,6 @@ SAGEMAKER = "sagemaker"
|
|
|
2
2
|
TABULAR_SAGEMAKER = "tabular_sagemaker"
|
|
3
3
|
MULTIMODL_SAGEMAKER = "multimodal_sagemaker"
|
|
4
4
|
TIMESERIES_SAGEMAKER = "timeseries_sagemaker"
|
|
5
|
-
RAY = "ray"
|
|
6
|
-
RAY_AWS = "ray_aws"
|
|
7
|
-
TABULAR_RAY_AWS = "tabular_ray_aws"
|
|
8
5
|
|
|
9
6
|
# Backends the top-level setup API can provision via CloudFormation.
|
|
10
|
-
SUPPORTED_BACKENDS = (SAGEMAKER,
|
|
7
|
+
SUPPORTED_BACKENDS = (SAGEMAKER,)
|