Time Series Forecasting
TiRex
martinloretzzz commited on
Commit
c7704f1
·
verified ·
1 Parent(s): fa77b31

Update README.md

Browse files

Update Readme to match the one on github.

Files changed (1) hide show
  1. README.md +114 -47
README.md CHANGED
@@ -9,58 +9,64 @@ license_link: https://huggingface.co/NX-AI/TiRex/blob/main/LICENSE
9
  license_name: nx-ai-community-license
10
  ---
11
 
12
- # TiRex
13
 
14
- TiRex is a **time-series foundation model** designed for **time series forecasting**,
15
- with the emphasis to provide state-of-the-art forecasts for both short- and long-term forecasting horizon.
16
- TiRex is **35M parameter** small and is based on the **[xLSTM architecture](https://github.com/NX-AI/xlstm)** allowing fast and performant forecasts.
17
- The model is described in the paper [TiRex: Zero-Shot Forecasting across Long and Short Horizons with Enhanced In-Context Learning](https://arxiv.org/abs/2505.23719).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  ### Key Facts:
20
 
21
  - **Zero-Shot Forecasting**:
22
- TiRex performs forecasting without any training on your data. Just download and forecast.
23
 
24
  - **Quantile Predictions**:
25
- TiRex not only provides point estimates but provides quantile estimates.
26
 
27
  - **State-of-the-art Performance over Long and Short Horizons**:
28
  TiRex achieves top scores in various time series forecasting benchmarks, see [GiftEval](https://huggingface.co/spaces/Salesforce/GIFT-Eval) and [ChronosZS](https://huggingface.co/spaces/autogluon/fev-leaderboard).
29
  These benchmark show that TiRex provides great performance for both long and short-term forecasting.
30
 
31
- ## Quick Start
32
-
33
- The inference code is available on [GitHub](https://github.com/NX-AI/tirex).
34
 
35
- ### Installation
36
-
37
- TiRex is currently only tested on *Linux systems* and Nvidia GPUs with compute capability >= 8.0.
38
- If you want to use different systems, please check the [FAQ in the code repository](https://github.com/NX-AI/tirex?tab=readme-ov-file#faq--troubleshooting).
39
- It's best to install TiRex in the specified conda environment.
40
- The respective conda dependency file is [requirements_py26.yaml](https://github.com/NX-AI/tirex/blob/main/requirements_py26.yaml).
41
 
42
  ```sh
43
- # 1) Setup and activate conda env from ./requirements_py26.yaml
44
- git clone github.com/NX-AI/tirex
45
- conda env create --file ./tirex/requirements_py26.yaml
46
- conda activate tirex
47
-
48
- # 2) [Mandatory] Install Tirex
49
-
50
- ## 2a) Install from source
51
- git clone github.com/NX-AI/tirex # if not already cloned before
52
- cd tirex
53
- pip install -e .
54
 
55
- # 2b) Install from PyPi (will be available soon)
 
 
 
56
 
57
- # 2) Optional: Install also optional dependencies
58
- pip install .[gluonts] # enable gluonTS in/output API
59
- pip install .[hfdataset] # enable HuggingFace datasets in/output API
60
- pip install .[notebooks] # To run the example notebooks
61
  ```
62
 
63
- ### Inference Example
 
 
64
 
65
  ```python
66
  import torch
@@ -68,34 +74,95 @@ from tirex import load_model, ForecastModel
68
 
69
  model: ForecastModel = load_model("NX-AI/TiRex")
70
  data = torch.rand((5, 128)) # Sample Data (5 time series with length 128)
71
- forecast = model.forecast(context=data, prediction_length=64)
72
  ```
73
 
74
- We provide an extended quick start example in the [GitHub repository](https://github.com/NX-AI/tirex/blob/main/examples/quick_start_tirex.ipynb).
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
- ### Troubleshooting / FAQ
 
77
 
78
- If you have problems please check the FAQ / Troubleshooting section in the [GitHub repository](https://github.com/NX-AI/tirex)
79
- and feel free to create a GitHub issue or start a discussion.
80
 
 
 
81
 
82
- ### Training Data
83
 
84
- - [chronos_datasets](https://huggingface.co/datasets/autogluon/chronos_datasets) (Subset - Zero Shot Benchmark data is not used for training - details in the paper)
85
- - [GiftEvalPretrain](https://huggingface.co/datasets/Salesforce/GiftEvalPretrain) (Subset - details in the paper)
86
- - Synthetic Data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  ## Cite
89
 
90
- If you use TiRex in your research, please cite our work:
91
 
92
  ```bibtex
93
- @article{auerTiRexZeroShotForecasting2025,
94
  title = {{{TiRex}}: {{Zero-Shot Forecasting Across Long}} and {{Short Horizons}} with {{Enhanced In-Context Learning}}},
95
- author = {Auer, Andreas and Podest, Patrick and Klotz, Daniel and B{\"o}ck, Sebastian and Klambauer, G{\"u}nter and Hochreiter, Sepp},
96
- journal = {ArXiv},
97
- volume = {2505.23719},
98
  year = {2025}
 
 
 
 
 
 
 
 
 
 
99
  }
100
  ```
101
 
 
9
  license_name: nx-ai-community-license
10
  ---
11
 
12
+ <div align="center">
13
 
14
+ # TiRex: Zero-Shot Forecasting across Long and Short Horizons
15
+
16
+ [![Paper](https://img.shields.io/static/v1?label=Paper&message=2505.23719&color=B31B1B&logo=arXiv)](https://arxiv.org/abs/2505.23719)
17
+ [![Hugging Face](https://img.shields.io/badge/HuggingFace-TiRex-yellow?logo=huggingface)](https://huggingface.co/NX-AI/TiRex)
18
+ [![PyPI](https://img.shields.io/pypi/v/tirex-ts?color=blue)](https://pypi.org/project/tirex-ts/)
19
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/tirex-ts?period=total&units=INTERNATIONAL_SYSTEM&left_color=GREY&right_color=BLUE&left_text=downloads)](https://pepy.tech/projects/tirex-ts)
20
+ [![License](https://img.shields.io/badge/license-nxai_community-green)](https://github.com/NX-AI/tirex-internal/blob/main/LICENSE)
21
+ [![docs](https://img.shields.io/website-up-down-green-red/http/nx-ai.github.io/tirex//.svg?label=docs)](https://nx-ai.github.io/tirex/)
22
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
23
+ [![formatter: docformatter](https://img.shields.io/badge/formatter-docformatter-fedcba.svg)](https://github.com/PyCQA/docformatter)
24
+
25
+ </div>
26
+
27
+
28
+ This repository provides the pre-trained forecasting model TiRex introduced in the paper
29
+ [TiRex: Zero-Shot Forecasting across Long and Short Horizons with Enhanced In-Context Learning](https://arxiv.org/abs/2505.23719).
30
+
31
+
32
+ ## TiRex Model
33
+
34
+ TiRex is a 35M parameter pre-trained time series forecasting model based on [xLSTM](https://github.com/NX-AI/xlstm).
35
 
36
  ### Key Facts:
37
 
38
  - **Zero-Shot Forecasting**:
39
+ TiRex is a pre-trained model that performs time series forecasting without requiring any training on your data. Simply download and use it.
40
 
41
  - **Quantile Predictions**:
42
+ TiRex provides both point estimates and quantile estimates.
43
 
44
  - **State-of-the-art Performance over Long and Short Horizons**:
45
  TiRex achieves top scores in various time series forecasting benchmarks, see [GiftEval](https://huggingface.co/spaces/Salesforce/GIFT-Eval) and [ChronosZS](https://huggingface.co/spaces/autogluon/fev-leaderboard).
46
  These benchmark show that TiRex provides great performance for both long and short-term forecasting.
47
 
48
+ ## Documentation
49
+ A detailed documentation of TiRex can be found here: https://nx-ai.github.io/tirex/
 
50
 
51
+ ## Installation
 
 
 
 
 
52
 
53
  ```sh
54
+ pip install tirex-ts
55
+ ```
 
 
 
 
 
 
 
 
 
56
 
57
+ Install with additional input/output adapter:
58
+ ```sh
59
+ pip install "tirex-ts[gluonts,hfdataset]"
60
+ ```
61
 
62
+ You can also install TiRex with all extras at once using:
63
+ ```sh
64
+ pip install "tirex-ts[all]"
 
65
  ```
66
 
67
+ TiRex is currently only tested on Linux and MacOS.
68
+
69
+ ## Quick Start
70
 
71
  ```python
72
  import torch
 
74
 
75
  model: ForecastModel = load_model("NX-AI/TiRex")
76
  data = torch.rand((5, 128)) # Sample Data (5 time series with length 128)
77
+ quantiles, mean = model.forecast(context=data, prediction_length=64)
78
  ```
79
 
80
+ We provide an extended quick start example in [examples/quick_start_tirex.ipynb](./examples/quick_start_tirex.ipynb).
81
+ This notebook also shows how to use the different input and output types of you time series data.
82
+ You can also run it in [Google Colab](https://colab.research.google.com/github/NX-AI/tirex/blob/main/examples/quick_start_tirex.ipynb).
83
+
84
+ We provide notebooks to run the benchmarks: [GiftEval](./examples/gifteval/gifteval.ipynb) and [Chronos-ZS](./examples/chronos_zs/chronos_zs.ipynb).
85
+
86
+ ## TiRex Classification Model
87
+ [![Paper](https://img.shields.io/static/v1?label=Paper&message=2510.26777&color=B31B1B&logo=arXiv)](http://arxiv.org/abs/2510.26777)
88
+
89
+ For detailed instructions on using TiRex classification model please visit our [documentation page](https://nx-ai.github.io/tirex/how-to/classification/) and [quick start Notebook](./examples/quick_start_tirex_classification.ipynb).
90
+
91
+ ## TiRex Docker image
92
+
93
+ For detailed instructions on building and running TiRex in a Docker container, see the [Docker README](./inference/README.md) or our [deployment documentation](https://nx-ai.github.io/tirex/deployment).
94
 
95
+ ## Finetuning TiRex
96
+ TiRex already provide state-of-the-art performance for zero-shot prediction. Hence, you can use it without training on your own data.
97
 
98
+ If you are interested in models fine-tuned on your data or with different pretraining, please contact us at [[email protected]](mailto:contact@nx-ai.com)
 
99
 
100
+ ## Troubleshooting
101
+ If you have problems please check the [documentation](https://nx-ai.github.io/tirex/) and feel free to create a GitHub issue or start a discussion.
102
 
 
103
 
104
+ ## CUDA Kernels
105
+
106
+ Tirex can use custom CUDA kernels for the sLSTM cells.
107
+ These CUDA kernels are compiled when the model is loaded the first time.
108
+ The CUDA kernels require GPU hardware that support CUDA compute capability 8.0 or later.
109
+ We also highly suggest to use the provided [conda environment spec](./requirements_cu124.yaml).
110
+ The CUDA kernels are automatically used when the xlstm package is installed.
111
+
112
+ To install TiRex with the CUDA kernels run:
113
+ ```sh
114
+ pip install "tirex-ts[cuda,gluonts,hfdataset]"
115
+ ```
116
+
117
+ Explicitly set the custom CUDA backend:
118
+ ```python
119
+ model = load_model("NX-AI/TiRex", backend="cuda")
120
+ ```
121
+
122
+ ### Troubleshooting CUDA
123
+
124
+ **This information is taken from the
125
+ [xLSTM repository](https://github.com/NX-AI/xlstm) - See this for further details**:
126
+
127
+ For the CUDA version of sLSTM, you need to specify Compute Capability, see [https://developer.nvidia.com/cuda-gpus](https://developer.nvidia.com/cuda-gpus). Or just specify a range as in the example below:
128
+ ```bash
129
+ export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"
130
+ ```
131
+
132
+ For all kinds of custom setups with torch and CUDA, keep in mind that versions have to match. Also, to make sure the correct CUDA libraries are included you can use the `XLSTM_EXTRA_INCLUDE_PATHS` environment variable now to inject different include paths, for example:
133
+
134
+ ```bash
135
+ export XLSTM_EXTRA_INCLUDE_PATHS='/usr/local/include/cuda/:/usr/include/cuda/'
136
+ ```
137
+
138
+ or within python:
139
+
140
+ ```python
141
+ import os
142
+ os.environ['XLSTM_EXTRA_INCLUDE_PATHS']='/usr/local/include/cuda/:/usr/include/cuda/'
143
+ ```
144
+
145
 
146
  ## Cite
147
 
148
+ If you use TiRex in your research, please cite our work:
149
 
150
  ```bibtex
151
+ @inproceedings{auer:25tirex,
152
  title = {{{TiRex}}: {{Zero-Shot Forecasting Across Long}} and {{Short Horizons}} with {{Enhanced In-Context Learning}}},
153
+ author = {Andreas Auer and Patrick Podest and Daniel Klotz and Sebastian B{\"o}ck and G{\"u}nter Klambauer and Sepp Hochreiter},
154
+ booktitle = {The Thirty-Ninth Annual Conference on Neural Information Processing Systems},
 
155
  year = {2025}
156
+ url = {https://arxiv.org/abs/2505.23719},
157
+ }
158
+ ```
159
+ ```bibtex
160
+ @inproceedings{auer:25tirexclassification,
161
+ title = {Pre-trained Forecasting Models: Strong Zero-Shot Feature Extractors for Time Series Classification},
162
+ author = {Andreas Auer and Daniel Klotz and Sebastinan B{\"o}ck and Sepp Hochreiter},
163
+ booktitle = {NeurIPS 2025 Workshop on Recent Advances in Time Series Foundation Models (BERT2S)},
164
+ year = {2025},
165
+ url = {https://arxiv.org/abs/2510.26777},
166
  }
167
  ```
168