Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/api/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Base

::: chronos.base.BaseChronosPipeline
options:
show_source: true
heading_level: 2
show_root_heading: true
show_root_toc_entry: true
members:
- predict
- predict_quantiles
- predict_df
- predict_fev
- from_pretrained
- model_context_length
- model_prediction_length
25 changes: 25 additions & 0 deletions docs/api/chronos-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Chronos

::: chronos.chronos2.pipeline.Chronos2Pipeline
options:
show_source: true
heading_level: 2
show_root_heading: true
show_root_toc_entry: true
members: null
members:
- predict
- predict_quantiles
- predict_df
- predict_fev
- embed
- fit
- from_pretrained
- save_pretrained
- model_context_length
- model_prediction_length
- model_output_patch_size
- quantiles
- max_output_patches
- model
- forecast_type
18 changes: 18 additions & 0 deletions docs/api/chronos-bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Chronos

::: chronos.chronos_bolt.ChronosBoltPipeline
options:
show_source: true
heading_level: 2
show_root_heading: true
show_root_toc_entry: true
members: null
members:
- predict
- predict_quantiles
- embed
- from_pretrained
- model_context_length
- model_prediction_length
- model
- forecast_type
18 changes: 18 additions & 0 deletions docs/api/chronos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Chronos

::: chronos.chronos.ChronosPipeline
options:
show_source: true
heading_level: 2
show_root_heading: true
show_root_toc_entry: true
members:
- predict
- predict_quantiles
- embed
- from_pretrained
- model_context_length
- model_prediction_length
- tokenizer
- model
- forecast_type
89 changes: 89 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# chronos-forecasting


## Introduction

This package provides an interface to the Chronos family of **pretrained time series forecasting models**. The following model types are supported.

- **Chronos-2**: Our latest model with significantly enhanced capabilities. It offers zero-shot support for univariate, multivariate, and covariate-informed forecasting tasks. Chronos-2 delivers state-of-the-art zero-shot performance across multiple benchmarks (including fev-bench and GIFT-Eval), with the largest improvements observed on tasks that include exogenous features. It also achieves a win rate of over 90% against Chronos-Bolt in head-to-head comparisons. To learn more about Chronos, check out the [technical report](https://arxiv.org/abs/2510.15821).
- **Chronos-Bolt**: A patch-based variant of Chronos. It chunks the historical time series context into patches of multiple observations, which are then input into the encoder. The decoder then uses these representations to directly generate quantile forecasts across multiple future steps—a method known as direct multi-step forecasting. Chronos-Bolt models are up to 250 times faster and 20 times more memory-efficient than the original Chronos models of the same size. To learn more about Chronos-Bolt, check out this [blog post](https://aws.amazon.com/blogs/machine-learning/fast-and-accurate-zero-shot-forecasting-with-chronos-bolt-and-autogluon/).
- **Chronos**: The original Chronos family which is based on language model architectures. A time series is transformed into a sequence of tokens via scaling and quantization, and a language model is trained on these tokens using the cross-entropy loss. Once trained, probabilistic forecasts are obtained by sampling multiple future trajectories given the historical context. To learn more about Chronos, check out the [publication](https://openreview.net/forum?id=gerNCVqqtR).

### Available Models

| Model ID | Parameters |
| ---------------------------------------------------------------------- | ---------- |
| [`amazon/chronos-2`](https://huggingface.co/amazon/chronos-2) | 120M |
| [`amazon/chronos-bolt-tiny`](https://huggingface.co/amazon/chronos-bolt-tiny) | 9M |
| [`amazon/chronos-bolt-mini`](https://huggingface.co/amazon/chronos-bolt-mini) | 21M |
| [`amazon/chronos-bolt-small`](https://huggingface.co/amazon/chronos-bolt-small) | 48M |
| [`amazon/chronos-bolt-base`](https://huggingface.co/amazon/chronos-bolt-base) | 205M |
| [`amazon/chronos-t5-tiny`](https://huggingface.co/amazon/chronos-t5-tiny) | 8M |
| [`amazon/chronos-t5-mini`](https://huggingface.co/amazon/chronos-t5-mini) | 20M |
| [`amazon/chronos-t5-small`](https://huggingface.co/amazon/chronos-t5-small) | 46M |
| [`amazon/chronos-t5-base`](https://huggingface.co/amazon/chronos-t5-base) | 200M |
| [`amazon/chronos-t5-large`](https://huggingface.co/amazon/chronos-t5-large) | 710M |




## Installation

```bash
pip install chronos-forecasting
```

## Quickstart

A minimal example showing how to perform forecasting using Chronos-2:

```py
import pandas as pd # requires: pip install 'pandas[pyarrow]'
from chronos import Chronos2Pipeline

pipeline = Chronos2Pipeline.from_pretrained("amazon/chronos-2", device_map="cuda")

# Load historical target values and past values of covariates
context_df = pd.read_parquet("https://autogluon.s3.amazonaws.com/datasets/timeseries/electricity_price/train.parquet")

# (Optional) Load future values of covariates
test_df = pd.read_parquet("https://autogluon.s3.amazonaws.com/datasets/timeseries/electricity_price/test.parquet")
future_df = test_df.drop(columns="target")

# Generate predictions with covariates
pred_df = pipeline.predict_df(
context_df,
future_df=future_df,
prediction_length=24, # Number of steps to forecast
quantile_levels=[0.1, 0.5, 0.9], # Quantile for probabilistic forecast
id_column="id", # Column identifying different time series
timestamp_column="timestamp", # Column with datetime information
target="target", # Column(s) with time series values to predict
)
```

We can now visualize the forecast:

```py
import matplotlib.pyplot as plt # requires: pip install matplotlib

ts_context = context_df.set_index("timestamp")["target"].tail(256)
ts_pred = pred_df.set_index("timestamp")
ts_ground_truth = test_df.set_index("timestamp")["target"]

ts_context.plot(label="historical data", color="xkcd:azure", figsize=(12, 3))
ts_ground_truth.plot(label="future data (ground truth)", color="xkcd:grass green")
ts_pred["predictions"].plot(label="forecast", color="xkcd:violet")
plt.fill_between(
ts_pred.index,
ts_pred["0.1"],
ts_pred["0.9"],
alpha=0.7,
label="prediction interval",
color="xkcd:light lavender",
)
plt.legend()
```

## Tutorials

40 changes: 40 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
site_name: chronos-forecasting
site_description: A library for the Chronos time series foundation models
site_url: https://amazon-science.github.io/chronos-forecasting/
repo_url: https://github.com/amazon-science/chronos-forecasting
repo_name: amazon-science/chronos-forecasting

theme:
name: material
palette:
primary: blue

plugins:
- search
- mkdocstrings:
handlers:
python:
options:
docstring_style: numpy
show_root_heading: true
show_root_full_path: false
show_signature_annotations: true
show_category_heading: true
group_by_category: true
allow_inspection: true

nav:
- Home: index.md
# - Tutorials:
# - Quickstart:
- API Reference:
- Base: api/base.md
- Chronos: api/chronos.md
- Chronos-Bolt: api/chronos-bolt.md
- Chronos-2: api/chronos-2.md

markdown_extensions:
- pymdownx.highlight
- pymdownx.superfences
- attr_list
- md_in_html
Loading