AutoGluon-Cloud

_images/autogluon-s.png

Train and Deploy AutoGluon in the Cloud

AutoGluon-Cloud lets you train and deploy state-of-the-art ML models in the cloud in a few lines of code. Run AutoGluon on Amazon SageMaker without worrying about infrastructure, dependencies, or a heavy local ML environment. It supports two workflows:

Installation

pip install autogluon.cloud

Before running any of the snippets below, follow the Setup tutorial to register the IAM role and S3 bucket that SageMaker will use.

Train AutoGluon predictors in the cloud

Full walkthrough: Tabular, Time Series.

Tabular

Train a classification or regression model on tabular data.

from autogluon.cloud import TabularCloudPredictor

# `train_data` and `test_data` can be a local path, S3 URL, or pandas DataFrame
train_data = "https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv"
test_data = "https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv"

# Train
cloud_predictor = TabularCloudPredictor()
cloud_predictor.fit(
    train_data=train_data,
    predictor_init_args={"label": "class"},  # passed to TabularPredictor()
    predictor_fit_args={"time_limit": 120},  # passed to TabularPredictor.fit()
)

# Real-time inference endpoint
cloud_predictor.deploy()
result = cloud_predictor.predict_real_time(test_data)
cloud_predictor.cleanup_deployment()

# Batch prediction
result = cloud_predictor.predict(test_data)
Time Series

Forecast future values of time series.

from autogluon.cloud import TimeSeriesCloudPredictor

# `data` can be a local path, S3 URL, or pandas DataFrame
data = "https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly_tiny/train.csv"

# Train
cloud_predictor = TimeSeriesCloudPredictor()
cloud_predictor.fit(
    train_data=data,
    predictor_init_args={"target": "target", "prediction_length": 24},  # passed to TimeSeriesPredictor()
    predictor_fit_args={"time_limit": 120},  # passed to TimeSeriesPredictor.fit()
)

# Real-time inference endpoint
cloud_predictor.deploy()
result = cloud_predictor.predict_real_time(data)
cloud_predictor.cleanup_deployment()

# Batch prediction
result = cloud_predictor.predict(data)

Run pretrained foundation models

Full walkthrough: Time Series.

Time Series (Chronos-2)

Zero-shot forecasts with a pretrained model — no training required.

from autogluon.cloud import TimeSeriesFoundationModel

# `data` can be a local path, S3 URL, or pandas DataFrame
data = "https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly_tiny/train.csv"

model = TimeSeriesFoundationModel("chronos-2")

# Batch prediction
predictions = model.predict(
    data=data,
    target="target",
    prediction_length=24,
)

# Real-time inference endpoint
endpoint = model.deploy()
predictions = endpoint.predict(
    data=data,
    target="target",
    prediction_length=24,
)
endpoint.delete_endpoint()