🚀 時序預測模型Chronos - Bolt⚡ (Tiny)
Chronos - Bolt是一系列預訓練的時間序列預測模型,可用於零樣本預測。它基於T5編解碼器架構,在近1000億個時間序列觀測值上進行了訓練,能將歷史時間序列上下文分塊輸入編碼器,解碼器再據此直接生成多個未來步驟的分位數預測。與同規模的原始Chronos模型相比,Chronos - Bolt模型更準確,推理速度快達250倍,內存效率高20倍。
🚀 快速開始
項目更新
🚀 2025年2月14日更新:Chronos - Bolt模型現已在Amazon SageMaker JumpStart上可用!查看教程筆記本,瞭解如何用幾行代碼部署Chronos端點以用於生產。
✨ 主要特性
- 高性能:與同規模的原始Chronos模型相比,Chronos - Bolt模型不僅推理速度顯著加快,而且預測更準確。
- 多尺寸可選:提供多種不同參數規模的模型,包括
chronos - bolt - tiny
、chronos - bolt - mini
、chronos - bolt - small
和chronos - bolt - base
。
- 零樣本預測:在未接觸過的數據集上也能實現良好的預測效果,超越了許多經過特定數據集訓練的統計模型和深度學習模型。
- 支持多種功能:支持微調、帶協變量的預測,並且可以部署到CPU和GPU實例。
📦 安裝指南
安裝AutoGluon依賴
pip install autogluon
更新SageMaker SDK
pip install -U sagemaker
💻 使用示例
基礎用法
在AutoGluon中使用Chronos - Bolt進行零樣本推理:
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": "autogluon/chronos-bolt-tiny"},
},
)
predictions = predictor.predict(df)
高級用法
部署Chronos - Bolt端點到SageMaker
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"]
更多高級功能,如微調和帶協變量的預測,請查看此教程。有關端點API的更多詳細信息,請查看示例筆記本。
📚 詳細文檔
性能對比
推理時間對比
以下圖表比較了Chronos - Bolt與原始Chronos模型在預測1024個時間序列時的推理時間,上下文長度為512個觀測值,預測步長為64步。
預測性能對比
以下圖表分別報告了Chronos - Bolt在加權分位數損失(WQL)和平均絕對縮放誤差(MASE)方面的概率預測和點預測性能,這些性能是在27個數據集上彙總得到的(詳情見Chronos論文)。值得注意的是,儘管Chronos - Bolt模型在訓練期間未接觸過這些數據集,但零樣本的Chronos - Bolt模型仍優於在這些數據集上訓練的常用統計模型和深度學習模型(用*表示)。此外,它們的性能也優於其他基礎模型(用+表示),這些基礎模型在我們的基準測試中的某些數據集上進行了預訓練,並非完全零樣本。值得一提的是,Chronos - Bolt (Base)在預測準確性方面也超過了原始的Chronos (Large)模型,同時速度快了600多倍。
模型尺寸
Chronos - Bolt模型有以下幾種尺寸可供選擇:
模型 |
參數數量 |
基於模型 |
[chronos - bolt - tiny](https://huggingface.co/autogluon/chronos - bolt - tiny) |
9M |
[t5 - efficient - tiny](https://huggingface.co/google/t5 - efficient - tiny) |
[chronos - bolt - mini](https://huggingface.co/autogluon/chronos - bolt - mini) |
21M |
[t5 - efficient - mini](https://huggingface.co/google/t5 - efficient - mini) |
[chronos - bolt - small](https://huggingface.co/autogluon/chronos - bolt - small) |
48M |
[t5 - efficient - small](https://huggingface.co/google/t5 - efficient - small) |
[chronos - bolt - base](https://huggingface.co/autogluon/chronos - bolt - base) |
205M |
[t5 - efficient - base](https://huggingface.co/google/t5 - efficient - base) |
📄 許可證
本項目採用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}
}