🚀 Chronos-T5 (Mini)
Chronos-T5 (Mini) 是基於語言模型架構的預訓練時間序列預測模型。它能將時間序列轉換為標記序列,通過交叉熵損失進行訓練,進而實現概率預測。該模型在大量公開時間序列數據及合成數據上進行訓練,為時間序列預測提供了強大的支持。
🚀 快速開始
- 2025年2月14日更新:Chronos-Bolt 和原始 Chronos 模型現已在 Amazon SageMaker JumpStart 上可用!查看 教程筆記本,瞭解如何用幾行代碼部署 Chronos 端點以用於生產。
- 2024年11月27日更新:我們發佈了 Chronos-Bolt⚡️ 模型,與相同大小的原始 Chronos 模型相比,它的準確性提高(誤差降低 5%),速度提高多達 250 倍,內存效率提高 20 倍。查看新模型 點擊此處。
Chronos 是一系列基於語言模型架構的預訓練時間序列預測模型。時間序列通過縮放和量化轉換為標記序列,語言模型使用交叉熵損失在這些標記上進行訓練。訓練完成後,通過在給定歷史上下文的情況下對多個未來軌跡進行採樣來獲得概率預測。Chronos 模型在大量公開可用的時間序列數據以及使用高斯過程生成的合成數據上進行了訓練。
有關 Chronos 模型、訓練數據和過程以及實驗結果的詳細信息,請參考論文 Chronos: Learning the Language of Time Series。
圖 1:Chronos 的高層描述。(左) 輸入時間序列經過縮放和量化以獲得標記序列。(中) 標記被輸入到語言模型中,該模型可以是編碼器 - 解碼器模型或僅解碼器模型。模型使用交叉熵損失進行訓練。(右) 在推理過程中,我們從模型中自迴歸地採樣標記,並將它們映射回數值。對多個軌跡進行採樣以獲得預測分佈。
✨ 主要特性
Chronos 模型基於語言模型架構,將時間序列轉化為標記序列進行訓練和預測。它在大量公開數據和合成數據上訓練,並且 Chronos-Bolt 模型相比原始模型在準確性、速度和內存效率上有顯著提升。
📦 安裝指南
要使用 Chronos 模型進行推理,請在 GitHub 配套倉庫 中運行以下命令安裝包:
pip install git+https://github.com/amazon-science/chronos-forecasting.git
💻 使用示例
基礎用法
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from chronos import ChronosPipeline
pipeline = ChronosPipeline.from_pretrained(
"amazon/chronos-t5-mini",
device_map="cuda",
torch_dtype=torch.bfloat16,
)
df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")
context = torch.tensor(df["#Passengers"])
prediction_length = 12
forecast = pipeline.predict(context, prediction_length)
forecast_index = range(len(df), len(df) + prediction_length)
low, median, high = np.quantile(forecast[0].numpy(), [0.1, 0.5, 0.9], axis=0)
plt.figure(figsize=(8, 4))
plt.plot(df["#Passengers"], color="royalblue", label="historical data")
plt.plot(forecast_index, median, color="tomato", label="median forecast")
plt.fill_between(forecast_index, low, high, color="tomato", alpha=0.3, label="80% prediction interval")
plt.legend()
plt.grid()
plt.show()
📚 詳細文檔
架構
本倉庫中的模型基於 T5 架構。唯一的區別在於詞彙量大小:Chronos-T5 模型使用 4096 種不同的標記,而原始 T5 模型使用 32128 種,這導致 Chronos-T5 模型的參數更少。
📄 許可證
本項目採用 Apache-2.0 許可證。
📚 引用
如果您發現 Chronos 模型對您的研究有用,請考慮引用相關 論文:
@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}
}
🔒 安全
更多信息請參閱 CONTRIBUTING。