Time Series Forecasting
Chronos
Safetensors
t5
time series
forecasting
pretrained models
foundation models
time series foundation models
time-series
Run this model with HF Jobs
Run amazon/chronos-bolt-tiny on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/amazon/chronos-bolt-tiny. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/amazon/chronos-bolt-tiny on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use amazon/chronos-bolt-tiny with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chronos
How to use amazon/chronos-bolt-tiny with Chronos:
pip install chronos-forecasting
import pandas as pd from chronos import BaseChronosPipeline pipeline = BaseChronosPipeline.from_pretrained("amazon/chronos-bolt-tiny", device_map="cuda") # Load historical data context_df = pd.read_csv("https://autogluon.s3.us-west-2.amazonaws.com/datasets/timeseries/misc/AirPassengers.csv") # Generate predictions pred_df = pipeline.predict_df( context_df, prediction_length=36, # Number of steps to forecast quantile_levels=[0.1, 0.5, 0.9], # Quantiles for probabilistic forecast id_column="item_id", # Column identifying different time series timestamp_column="Month", # Column with datetime information target="#Passengers", # Column(s) with time series values to predict ) - Notebooks
- Google Colab
- Kaggle
Commit ·
6904c2c
0
Parent(s):
initial commit
Browse filesFiles changed (4)
- .gitattributesAdded+35
- README.mdAdded+110
- config.jsonAdded+51
- model.safetensorsAdded+3
1234567891011121314151617181920212223242526272829303132333435*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110---license: apache-2.0pipeline_tag: time-series-forecastingtags: - time series - forecasting - pretrained models - foundation models - time series foundation models - time-series---
# Chronos-Bolt-Tiny
Chronos-Bolt is a family of pretrained time series forecasting models which can be used for zero-shot forecasting. Chronos-Bolt models are based on the [T5 architecture](https://arxiv.org/abs/1910.10683) and are available in the following sizes.
<div align="center">
| Model | Parameters | Based on || ----------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------- || [**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) |
</div>
## Usage with AutoGluon
> [!WARNING] > Chronos-Bolt models will be available in the next stable release of AutoGluon, so the following instructions will only work once AutoGluon 1.2 has been released.
The recommended way of using Chronos for production use cases is through [AutoGluon](https://auto.gluon.ai/stable/index.html), which features effortless fine-tuning, ensembling with other statistical and machine learning models for time series forecasting as well as seamless deployments on AWS with SageMaker.Check out the AutoGluon Chronos [tutorial](https://auto.gluon.ai/stable/tutorials/timeseries/forecasting-chronos.html).
A minimal example showing how to perform zero-shot inference using Chronos-Bolt with AutoGluon:
```pip install autogluon```
```pythonfrom 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-tiny"}, },)
predictions = predictor.predict(df)```
## Usage with inference library
Alternatively, you can install the package in the GitHub [companion repo](https://github.com/amazon-science/chronos-forecasting).This is intended for research purposes and provides a minimal interface to Chronos models.Install the library by running:
```pip install git+https://github.com/amazon-science/chronos-forecasting.git```
A minimal example showing how to perform inference using Chronos-Bolt models:
```pythonimport pandas as pd # requires: pip install pandasimport torchfrom chronos import BaseChronosPipeline
pipeline = BaseChronosPipeline.from_pretrained( "amazon/chronos-bolt-tiny", 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)```
## Citation
If you find Chronos or Chronos-Bolt models useful for your research, please consider citing the associated [paper](https://arxiv.org/abs/2403.07815):
```@article{ansari2024chronos, 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}, title = {Chronos: Learning the Language of Time Series}, journal = {arXiv preprint arXiv:2403.07815}, year = {2024}}```
## License
This project is licensed under the Apache-2.0 License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051{ "_name_or_path": "autogluon/chronos-bolt-tiny", "architectures": [ "ChronosBoltModelForForecasting" ], "chronos_config": { "context_length": 2048, "input_patch_size": 16, "input_patch_stride": 16, "prediction_length": 64, "quantiles": [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 ], "use_reg_token": true }, "chronos_pipeline_class": "ChronosBoltPipeline", "classifier_dropout": 0.0, "d_ff": 1024, "d_kv": 64, "d_model": 256, "decoder_start_token_id": 0, "dense_act_fn": "relu", "dropout_rate": 0.1, "eos_token_id": 1, "feed_forward_proj": "relu", "initializer_factor": 0.05, "is_encoder_decoder": true, "is_gated_act": false, "layer_norm_epsilon": 1e-06, "model_type": "t5", "n_positions": 512, "num_decoder_layers": 4, "num_heads": 4, "num_layers": 4, "pad_token_id": 0, "reg_token_id": 1, "relative_attention_max_distance": 128, "relative_attention_num_buckets": 32, "torch_dtype": "float32", "transformers_version": "4.39.3", "use_cache": true, "vocab_size": 2}123version https://git-lfs.github.com/spec/v1oid sha256:75068728d376d2bec670379eeef4bfb4d24c0cfe24d957451f8d19b447030a32size 34622352.gitattributesAdded+35
README.mdAdded+110
config.jsonAdded+51
model.safetensorsAdded+3