abdulfatir commited on
Commit
1962549
0 Parent(s):

initial commit

Browse files
Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +110 -0
  3. config.json +51 -0
  4. model.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: time-series-forecasting
4
+ tags:
5
+ - time series
6
+ - forecasting
7
+ - pretrained models
8
+ - foundation models
9
+ - time series foundation models
10
+ - time-series
11
+ ---
12
+
13
+ # Chronos-Bolt-Mini
14
+
15
+ 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.
16
+
17
+
18
+ <div align="center">
19
+
20
+ | Model | Parameters | Based on |
21
+ | ----------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------- |
22
+ | [**chronos-bolt-tiny**](https://huggingface.co/autogluon/chronos-bolt-tiny) | 9M | [t5-efficient-tiny](https://huggingface.co/google/t5-efficient-tiny) |
23
+ | [**chronos-bolt-mini**](https://huggingface.co/autogluon/chronos-bolt-mini) | 21M | [t5-efficient-mini](https://huggingface.co/google/t5-efficient-mini) |
24
+ | [**chronos-bolt-small**](https://huggingface.co/autogluon/chronos-bolt-small) | 48M | [t5-efficient-small](https://huggingface.co/google/t5-efficient-small) |
25
+ | [**chronos-bolt-base**](https://huggingface.co/autogluon/chronos-bolt-base) | 205M | [t5-efficient-base](https://huggingface.co/google/t5-efficient-base) |
26
+
27
+ </div>
28
+
29
+
30
+ ## Usage with AutoGluon
31
+
32
+ > [!WARNING]
33
+ > 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.
34
+
35
+ 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.
36
+ Check out the AutoGluon Chronos [tutorial](https://auto.gluon.ai/stable/tutorials/timeseries/forecasting-chronos.html).
37
+
38
+ A minimal example showing how to perform zero-shot inference using Chronos-Bolt with AutoGluon:
39
+
40
+ ```
41
+ pip install autogluon
42
+ ```
43
+
44
+ ```python
45
+ from autogluon.timeseries import TimeSeriesPredictor, TimeSeriesDataFrame
46
+
47
+ df = TimeSeriesDataFrame("https://autogluon.s3.amazonaws.com/datasets/timeseries/m4_hourly/train.csv")
48
+
49
+ predictor = TimeSeriesPredictor(prediction_length=48).fit(
50
+ df,
51
+ hyperparameters={
52
+ "Chronos": {"model_path": "amazon/chronos-bolt-mini"},
53
+ },
54
+ )
55
+
56
+ predictions = predictor.predict(df)
57
+ ```
58
+
59
+ ## Usage with inference library
60
+
61
+ Alternatively, you can install the package in the GitHub [companion repo](https://github.com/amazon-science/chronos-forecasting).
62
+ This is intended for research purposes and provides a minimal interface to Chronos models.
63
+ Install the library by running:
64
+
65
+ ```
66
+ pip install git+https://github.com/amazon-science/chronos-forecasting.git
67
+ ```
68
+
69
+ A minimal example showing how to perform inference using Chronos-Bolt models:
70
+
71
+ ```python
72
+ import pandas as pd # requires: pip install pandas
73
+ import torch
74
+ from chronos import BaseChronosPipeline
75
+
76
+ pipeline = BaseChronosPipeline.from_pretrained(
77
+ "amazon/chronos-bolt-mini",
78
+ device_map="cuda", # use "cpu" for CPU inference and "mps" for Apple Silicon
79
+ torch_dtype=torch.bfloat16,
80
+ )
81
+
82
+ df = pd.read_csv(
83
+ "https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv"
84
+ )
85
+
86
+ # context must be either a 1D tensor, a list of 1D tensors,
87
+ # or a left-padded 2D tensor with batch as the first dimension
88
+ # Chronos-Bolt models generate quantile forecasts, so forecast has shape
89
+ # [num_series, num_quantiles, prediction_length].
90
+ forecast = pipeline.predict(
91
+ context=torch.tensor(df["#Passengers"]), prediction_length=12
92
+ )
93
+ ```
94
+
95
+ ## Citation
96
+
97
+ If you find Chronos or Chronos-Bolt models useful for your research, please consider citing the associated [paper](https://arxiv.org/abs/2403.07815):
98
+
99
+ ```
100
+ @article{ansari2024chronos,
101
+ 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},
102
+ title = {Chronos: Learning the Language of Time Series},
103
+ journal = {arXiv preprint arXiv:2403.07815},
104
+ year = {2024}
105
+ }
106
+ ```
107
+
108
+ ## License
109
+
110
+ This project is licensed under the Apache-2.0 License.
config.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "autogluon/chronos-bolt-mini",
3
+ "architectures": [
4
+ "ChronosBoltModelForForecasting"
5
+ ],
6
+ "chronos_config": {
7
+ "context_length": 2048,
8
+ "input_patch_size": 16,
9
+ "input_patch_stride": 16,
10
+ "prediction_length": 64,
11
+ "quantiles": [
12
+ 0.1,
13
+ 0.2,
14
+ 0.3,
15
+ 0.4,
16
+ 0.5,
17
+ 0.6,
18
+ 0.7,
19
+ 0.8,
20
+ 0.9
21
+ ],
22
+ "use_reg_token": true
23
+ },
24
+ "chronos_pipeline_class": "ChronosBoltPipeline",
25
+ "classifier_dropout": 0.0,
26
+ "d_ff": 1536,
27
+ "d_kv": 64,
28
+ "d_model": 384,
29
+ "decoder_start_token_id": 0,
30
+ "dense_act_fn": "relu",
31
+ "dropout_rate": 0.1,
32
+ "eos_token_id": 1,
33
+ "feed_forward_proj": "relu",
34
+ "initializer_factor": 0.05,
35
+ "is_encoder_decoder": true,
36
+ "is_gated_act": false,
37
+ "layer_norm_epsilon": 1e-06,
38
+ "model_type": "t5",
39
+ "n_positions": 512,
40
+ "num_decoder_layers": 4,
41
+ "num_heads": 8,
42
+ "num_layers": 4,
43
+ "pad_token_id": 0,
44
+ "reg_token_id": 1,
45
+ "relative_attention_max_distance": 128,
46
+ "relative_attention_num_buckets": 32,
47
+ "torch_dtype": "float32",
48
+ "transformers_version": "4.39.3",
49
+ "use_cache": true,
50
+ "vocab_size": 2
51
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a1a4297f132b808c5c7da24e3cce549d519c01ff5c2661fcad404baba018f24
3
+ size 84956096