モデル概要
モデル特徴
モデル能力
使用事例
🚀 Chronos - Bolt⚡ (Mini)
Chronos - Boltは、ゼロショット予測に使用できる事前学習済みの時系列予測モデルのファミリーです。このモデルは、T5エンコーダ - デコーダアーキテクチャに基づいており、約1000億の時系列観測データで学習されています。過去の時系列コンテキストを複数の観測値のパッチに分割し、エンコーダに入力します。そして、デコーダはこれらの表現を使用して、複数の未来のステップにわたる分位点予測を直接生成します。これは、直接多ステップ予測として知られる方法です。Chronos - Boltモデルは、同じサイズの元のChronosモデルよりも最大250倍高速で、20倍メモリ効率が高いです。
🚀 2025年2月14日更新: Chronos - BoltモデルがAmazon SageMaker JumpStartで利用可能になりましたを参照して、数行のコードでChronosエンドポイントを本番環境で使用するためにデプロイする方法を学んでください。
🚀 クイックスタート
Chronos - Boltは事前学習済みの時系列予測モデルで、ゼロショット予測に利用できます。以下では、その性能や使用方法について説明します。
✨ 主な機能
- 高速かつ省メモリ:同じサイズの元のChronosモデルよりも最大250倍高速で、20倍メモリ効率が高い。
- 高精度:多くのデータセットで、統計モデルや他の深層学習モデルを上回る予測精度を示す。
- ゼロショット予測:学習時に見たことのないデータセットでも高精度な予測が可能。
🔧 技術詳細
Chronos - BoltはT5エンコーダ - デコーダアーキテクチャに基づいており、約1000億の時系列観測データで学習されています。過去の時系列コンテキストを複数の観測値のパッチに分割し、エンコーダに入力します。デコーダはこれらの表現を使用して、複数の未来のステップにわたる分位点予測を直接生成します(直接多ステップ予測)。
📦 インストール
AutoGluonを使用する場合
必要な依存関係をインストールします。
pip install autogluon
SageMakerにエンドポイントをデプロイする場合
SageMaker SDKを最新版に更新します。
pip install -U sagemaker
推論ライブラリを使用する場合
GitHubの[コンパニオンリポジトリ](https://github.com/amazon - science/chronos - forecasting)のパッケージをインストールします。
pip install chronos - forecasting
💻 使用例
基本的な使用法
AutoGluonを使用したゼロショット推論
from autogluon.timeseries import TimeSeriesPredictor, TimeSeriesDataFrame
df = TimeSeriesDataFrame("https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly/train.csv")
predictor = TimeSeriesPredictor(prediction_length=48).fit(
df,
hyperparameters={
"Chronos": {"model_path": "amazon/chronos-bolt-mini"},
},
)
predictions = predictor.predict(df)
SageMakerにChronos - Bolt (Base)エンドポイントをデプロイ
from sagemaker.jumpstart.model import JumpStartModel
model = JumpStartModel(
model_id="autogluon-forecasting-chronos-bolt-base",
instance_type="ml.c5.2xlarge",
)
predictor = model.deploy()
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")
payload = {
"inputs": [
{"target": df["#Passengers"].tolist()}
],
"parameters": {
"prediction_length": 12,
}
}
forecast = predictor.predict(payload)["predictions"]
推論ライブラリを使用した推論
import pandas as pd # requires: pip install pandas
import torch
from chronos import BaseChronosPipeline
pipeline = BaseChronosPipeline.from_pretrained(
"amazon/chronos-bolt-mini",
device_map="cuda", # use "cpu" for CPU inference and "mps" for Apple Silicon
torch_dtype=torch.bfloat16,
)
df = pd.read_csv(
"https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv"
)
# context must be either a 1D tensor, a list of 1D tensors,
# or a left-padded 2D tensor with batch as the first dimension
# Chronos-Bolt models generate quantile forecasts, so forecast has shape
# [num_series, num_quantiles, prediction_length].
forecast = pipeline.predict(
context=torch.tensor(df["#Passengers"]), prediction_length=12
)
📚 ドキュメント
性能
推論時間の比較
以下のプロットは、コンテキスト長が512観測値、予測期間が64ステップで1024の時系列を予測する際の、Chronos - Boltと元のChronosモデルの推論時間を比較しています。
予測精度の比較
Chronos - Boltモデルは、元のChronosモデルよりも大幅に高速で、かつ高精度です。以下のプロットは、27のデータセットにわたって集計された、[Weighted Quantile Loss (WQL)](https://auto.gluon.ai/stable/tutorials/timeseries/forecasting - metrics.html#autogluon.timeseries.metrics.WQL)と[Mean Absolute Scaled Error (MASE)](https://auto.gluon.ai/stable/tutorials/timeseries/forecasting - metrics.html#autogluon.timeseries.metrics.MASE)に基づく、Chronos - Boltの確率的予測と点予測の性能を示しています(詳細はChronos論文を参照)。注目すべきは、学習時にこれらのデータセットに触れたことのないゼロショットのChronos - Boltモデルが、これらのデータセットで学習された一般的な統計モデルや深層学習モデル(*で強調)を上回っていることです。さらに、+で示される他の事前学習モデル(ベンチマークの特定のデータセットで事前学習された、完全なゼロショットではないモデル)よりも優れています。特に、Chronos - Bolt (Base)は、予測精度の面で元のChronos (Large)モデルを上回り、かつ600倍以上高速です。
モデルのサイズ
Chronos - Boltモデルは以下のサイズで利用可能です。
モデル | パラメータ | ベースとなるモデル |
---|---|---|
[chronos - bolt - tiny](https://huggingface.co/amazon/chronos - bolt - tiny) | 9M | [t5 - efficient - tiny](https://huggingface.co/google/t5 - efficient - tiny) |
[chronos - bolt - mini](https://huggingface.co/amazon/chronos - bolt - mini) | 21M | [t5 - efficient - mini](https://huggingface.co/google/t5 - efficient - mini) |
[chronos - bolt - small](https://huggingface.co/amazon/chronos - bolt - small) | 48M | [t5 - efficient - small](https://huggingface.co/google/t5 - efficient - small) |
[chronos - bolt - base](https://huggingface.co/amazon/chronos - bolt - base) | 205M | [t5 - efficient - base](https://huggingface.co/google/t5 - efficient - base) |
使用方法
AutoGluonを使用する場合
本番環境でChronosを使用する場合は、AutoGluonを通じて使用することが推奨されます。AutoGluonは、Chronosモデルの簡単な微調整、共変量回帰を通じた共変量の予測への組み込み、および他の統計モデルや機械学習モデルとのアンサンブルを提供し、最大の精度を実現します。詳細はAutoGluon Chronosの[チュートリアル](https://auto.gluon.ai/stable/tutorials/timeseries/forecasting - chronos.html)を参照してください。
SageMakerにエンドポイントをデプロイする場合
SageMaker JumpStartを使用すると、数行のコードでChronosエンドポイントを本番環境で使用するために簡単にデプロイできます。Chronos - BoltエンドポイントはCPUとGPUの両方のインスタンスにデプロイでき、共変量を用いた予測もサポートしています。詳細はこの[サンプルノートブック](https://github.com/amazon - science/chronos - forecasting/blob/main/notebooks/deploy - chronos - bolt - to - amazon - sagemaker.ipynb)を参照してください。
推論ライブラリを使用する場合
これは研究目的で使用することを想定しており、Chronosモデルへの最小限のインターフェースを提供します。
📄 ライセンス
このプロジェクトは、Apache - 2.0ライセンスの下でライセンスされています。
📚 引用
もしChronosまたはChronos - Boltモデルがあなたの研究に役立った場合、関連する論文を引用することを検討してください。
@article{ansari2024chronos,
title={Chronos: Learning the Language of Time Series},
author={Ansari, Abdul Fatir and Stella, Lorenzo and Turkmen, Caner and Zhang, Xiyuan, and Mercado, Pedro and Shen, Huibin and Shchur, Oleksandr and Rangapuram, Syama Syndar and Pineda Arango, Sebastian and Kapoor, Shubham and Zschiegner, Jasper and Maddix, Danielle C. and Mahoney, Michael W. and Torkkola, Kari and Gordon Wilson, Andrew and Bohlke-Schneider, Michael and Wang, Yuyang},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2024},
url={https://openreview.net/forum?id=gerNCVqqtR}
}




