Remove irrelevant stuff from config.json
#1
by
abdulfatir
- opened
- README.md +1 -101
- chronos_config.json +16 -0
- config.json +6 -23
- figures/main-figure.png +0 -0
- model.safetensors → pytorch_model.bin +2 -2
README.md
CHANGED
@@ -1,104 +1,4 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
-
pipeline_tag:
|
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-T5 (Base)
|
14 |
-
|
15 |
-
Chronos is a family of **pretrained time series forecasting models** based on language model architectures. A time series is transformed into a sequence of tokens via scaling and quantization, and a language model is trained on these tokens using the cross-entropy loss. Once trained, probabilistic forecasts are obtained by sampling multiple future trajectories given the historical context. Chronos models have been trained on a large corpus of publicly available time series data, as well as synthetic data generated using Gaussian processes.
|
16 |
-
|
17 |
-
For details on Chronos models, training data and procedures, and experimental results, please refer to the paper [Chronos: Learning the Language of Time Series](https://arxiv.org/abs/2403.07815).
|
18 |
-
|
19 |
-
<p align="center">
|
20 |
-
<img src="figures/main-figure.png" width="100%">
|
21 |
-
<br />
|
22 |
-
<span>
|
23 |
-
Fig. 1: High-level depiction of Chronos. (<b>Left</b>) The input time series is scaled and quantized to obtain a sequence of tokens. (<b>Center</b>) The tokens are fed into a language model which may either be an encoder-decoder or a decoder-only model. The model is trained using the cross-entropy loss. (<b>Right</b>) During inference, we autoregressively sample tokens from the model and map them back to numerical values. Multiple trajectories are sampled to obtain a predictive distribution.
|
24 |
-
</span>
|
25 |
-
</p>
|
26 |
-
|
27 |
-
---
|
28 |
-
|
29 |
-
## Architecture
|
30 |
-
|
31 |
-
The models in this repository are based on the [T5 architecture](https://arxiv.org/abs/1910.10683). The only difference is in the vocabulary size: Chronos-T5 models use 4096 different tokens, compared to 32128 of the original T5 models, resulting in fewer parameters.
|
32 |
-
|
33 |
-
| Model | Parameters | Based on |
|
34 |
-
| ---------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------- |
|
35 |
-
| [**chronos-t5-tiny**](https://huggingface.co/amazon/chronos-t5-tiny) | 8M | [t5-efficient-tiny](https://huggingface.co/google/t5-efficient-tiny) |
|
36 |
-
| [**chronos-t5-mini**](https://huggingface.co/amazon/chronos-t5-mini) | 20M | [t5-efficient-mini](https://huggingface.co/google/t5-efficient-mini) |
|
37 |
-
| [**chronos-t5-small**](https://huggingface.co/amazon/chronos-t5-small) | 46M | [t5-efficient-small](https://huggingface.co/google/t5-efficient-small) |
|
38 |
-
| [**chronos-t5-base**](https://huggingface.co/amazon/chronos-t5-base) | 200M | [t5-efficient-base](https://huggingface.co/google/t5-efficient-base) |
|
39 |
-
| [**chronos-t5-large**](https://huggingface.co/amazon/chronos-t5-large) | 710M | [t5-efficient-large](https://huggingface.co/google/t5-efficient-large) |
|
40 |
-
|
41 |
-
## Usage
|
42 |
-
|
43 |
-
To perform inference with Chronos models, install the package in the GitHub [companion repo](https://github.com/amazon-science/chronos-forecasting) by running:
|
44 |
-
|
45 |
-
```
|
46 |
-
pip install git+https://github.com/amazon-science/chronos-forecasting.git
|
47 |
-
```
|
48 |
-
|
49 |
-
A minimal example showing how to perform inference using Chronos models:
|
50 |
-
|
51 |
-
```python
|
52 |
-
import matplotlib.pyplot as plt
|
53 |
-
import numpy as np
|
54 |
-
import pandas as pd
|
55 |
-
import torch
|
56 |
-
from chronos import ChronosPipeline
|
57 |
-
|
58 |
-
pipeline = ChronosPipeline.from_pretrained(
|
59 |
-
"amazon/chronos-t5-base",
|
60 |
-
device_map="cuda",
|
61 |
-
torch_dtype=torch.bfloat16,
|
62 |
-
)
|
63 |
-
|
64 |
-
df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")
|
65 |
-
|
66 |
-
# context must be either a 1D tensor, a list of 1D tensors,
|
67 |
-
# or a left-padded 2D tensor with batch as the first dimension
|
68 |
-
context = torch.tensor(df["#Passengers"])
|
69 |
-
prediction_length = 12
|
70 |
-
forecast = pipeline.predict(context, prediction_length) # shape [num_series, num_samples, prediction_length]
|
71 |
-
|
72 |
-
# visualize the forecast
|
73 |
-
forecast_index = range(len(df), len(df) + prediction_length)
|
74 |
-
low, median, high = np.quantile(forecast[0].numpy(), [0.1, 0.5, 0.9], axis=0)
|
75 |
-
|
76 |
-
plt.figure(figsize=(8, 4))
|
77 |
-
plt.plot(df["#Passengers"], color="royalblue", label="historical data")
|
78 |
-
plt.plot(forecast_index, median, color="tomato", label="median forecast")
|
79 |
-
plt.fill_between(forecast_index, low, high, color="tomato", alpha=0.3, label="80% prediction interval")
|
80 |
-
plt.legend()
|
81 |
-
plt.grid()
|
82 |
-
plt.show()
|
83 |
-
```
|
84 |
-
|
85 |
-
## Citation
|
86 |
-
|
87 |
-
If you find Chronos models useful for your research, please consider citing the associated [paper](https://arxiv.org/abs/2403.07815):
|
88 |
-
|
89 |
-
```
|
90 |
-
@article{ansari2024chronos,
|
91 |
-
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},
|
92 |
-
title = {Chronos: Learning the Language of Time Series},
|
93 |
-
journal = {arXiv preprint arXiv:2403.07815},
|
94 |
-
year = {2024}
|
95 |
-
}
|
96 |
-
```
|
97 |
-
|
98 |
-
## Security
|
99 |
-
|
100 |
-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
|
101 |
-
|
102 |
-
## License
|
103 |
-
|
104 |
-
This project is licensed under the Apache-2.0 License.
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
pipeline_tag: other
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chronos_config.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"low_limit": -15.0,
|
3 |
+
"high_limit": 15.0,
|
4 |
+
"n_tokens": 4096,
|
5 |
+
"n_special_tokens": 2,
|
6 |
+
"pad_token_id": 0,
|
7 |
+
"eos_token_id": 1,
|
8 |
+
"use_eos_token": true,
|
9 |
+
"model_type": "seq2seq",
|
10 |
+
"context_length": 512,
|
11 |
+
"prediction_length": 64,
|
12 |
+
"num_samples": 20,
|
13 |
+
"temperature": 1.0,
|
14 |
+
"top_k": 50,
|
15 |
+
"top_p": 1.0
|
16 |
+
}
|
config.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
{
|
2 |
-
"architectures": [
|
|
|
|
|
3 |
"d_ff": 3072,
|
4 |
"d_kv": 64,
|
5 |
"d_model": 768,
|
@@ -11,7 +13,7 @@
|
|
11 |
"initializer_factor": 0.05,
|
12 |
"is_encoder_decoder": true,
|
13 |
"is_gated_act": false,
|
14 |
-
"layer_norm_epsilon": 1e-
|
15 |
"model_type": "t5",
|
16 |
"n_positions": 512,
|
17 |
"num_decoder_layers": 12,
|
@@ -20,27 +22,8 @@
|
|
20 |
"pad_token_id": 0,
|
21 |
"relative_attention_max_distance": 128,
|
22 |
"relative_attention_num_buckets": 32,
|
23 |
-
"torch_dtype": "
|
24 |
"transformers_version": "4.31.0",
|
25 |
"use_cache": true,
|
26 |
-
"vocab_size": 4096
|
27 |
-
"chronos_config": {
|
28 |
-
"tokenizer_class": "MeanScaleUniformBins",
|
29 |
-
"tokenizer_kwargs": {
|
30 |
-
"low_limit": -15.0,
|
31 |
-
"high_limit": 15.0
|
32 |
-
},
|
33 |
-
"n_tokens": 4096,
|
34 |
-
"n_special_tokens": 2,
|
35 |
-
"pad_token_id": 0,
|
36 |
-
"eos_token_id": 1,
|
37 |
-
"use_eos_token": true,
|
38 |
-
"model_type": "seq2seq",
|
39 |
-
"context_length": 512,
|
40 |
-
"prediction_length": 64,
|
41 |
-
"num_samples": 20,
|
42 |
-
"temperature": 1.0,
|
43 |
-
"top_k": 50,
|
44 |
-
"top_p": 1.0
|
45 |
-
}
|
46 |
}
|
|
|
1 |
{
|
2 |
+
"architectures": [
|
3 |
+
"T5ForConditionalGeneration"
|
4 |
+
],
|
5 |
"d_ff": 3072,
|
6 |
"d_kv": 64,
|
7 |
"d_model": 768,
|
|
|
13 |
"initializer_factor": 0.05,
|
14 |
"is_encoder_decoder": true,
|
15 |
"is_gated_act": false,
|
16 |
+
"layer_norm_epsilon": 1e-06,
|
17 |
"model_type": "t5",
|
18 |
"n_positions": 512,
|
19 |
"num_decoder_layers": 12,
|
|
|
22 |
"pad_token_id": 0,
|
23 |
"relative_attention_max_distance": 128,
|
24 |
"relative_attention_num_buckets": 32,
|
25 |
+
"torch_dtype": "bfloat16",
|
26 |
"transformers_version": "4.31.0",
|
27 |
"use_cache": true,
|
28 |
+
"vocab_size": 4096
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
figures/main-figure.png
DELETED
Binary file (232 kB)
|
|
model.safetensors → pytorch_model.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ba0e0e6b96f6463cbcb9a8a58679151b804050bedd11617b17aab507e71f33cc
|
3 |
+
size 402838673
|