Instructions to use NX-AI/TiRex-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TiRex-2
How to use NX-AI/TiRex-2 with TiRex-2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
docs: align model card with GitHub README and documentation
#4
by lukfischer - opened
README.md
CHANGED
|
@@ -6,28 +6,45 @@ pipeline_tag: time-series-forecasting
|
|
| 6 |
library_name: tirex-2
|
| 7 |
license: apache-2.0
|
| 8 |
---
|
| 9 |
-
<div align="
|
| 10 |
<img src="tirex.svg" alt="TiRex mascot" width="33" height="40" />
|
| 11 |
<h1 class="m-0">TiRex-2: Generalizing TiRex to Multivariate Data and Streaming</h1>
|
| 12 |
</div>
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
variates directly from their history, optionally conditioned on past and future-known
|
| 20 |
-
covariates. A single checkpoint serves both univariate and multivariate forecasting
|
| 21 |
-
|
| 22 |
-
task-specific training or fine-tuning.
|
| 23 |
|
| 24 |
-
TiRex-2 generalizes our original univariate model, [TiRex](https://
|
| 25 |
multivariate forecasting with past and future covariates.
|
| 26 |
|
| 27 |
## Key facts
|
| 28 |
|
| 29 |
-
- **Zero-shot multivariate forecasting**:
|
| 30 |
-
TiRex-2 forecasts multiple target variates out of the box, without training or fine-tuning on
|
| 31 |
|
| 32 |
- **Past and future-known covariates**:
|
| 33 |
TiRex-2 natively conditions on past covariates and future-known covariates, such as
|
|
@@ -37,64 +54,149 @@ multivariate forecasting with past and future covariates.
|
|
| 37 |
TiRex-2 activates 38.4M parameters in univariate mode and an additional 44.1M parameters
|
| 38 |
for multivariate forecasting.
|
| 39 |
|
| 40 |
-
##
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
> examples, and benchmark reproduction — see our [GitHub repository](https://github.com/NX-AI/tirex-2).
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
```bash
|
| 48 |
-
|
| 49 |
-
git clone https://github.com/NX-AI/tirex-2 && cd tirex-2
|
| 50 |
-
# activate the cpu-only env
|
| 51 |
-
eval "$(pixi shell-hook -e example)" # to execute on GPUs use `example-cu128` or `example-cu126`
|
| 52 |
```
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
```python
|
| 56 |
-
import
|
| 57 |
from tirex2 import TimeseriesType, load_model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
|
|
|
| 59 |
model = load_model("NX-AI/TiRex-2", device="cpu") # use `device="cuda"` if cuda is available
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
```
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
We provide predefined Pixi tasks showcasing examplary forecasts. These run in the CPU-only `example` environment by default:
|
| 66 |
-
- `pixi run minimal` runs above code and creates a plot of the forecast.
|
| 67 |
-
- `pixi run comparison` showcases the additional benefit of future known covariates in forecasting a target.
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
## TiRex-2
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
TiRex-2 already provides state-of-the-art performance for zero-shot prediction, so you can use this open-source release without training on your own data.
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
- **
|
| 77 |
-
- **
|
| 78 |
-
- **
|
|
|
|
| 79 |
- **Classification & Regression**: TiRex-2 adapted for classification and regression tasks.
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
## Cite
|
|
|
|
| 84 |
If you use TiRex-2 in your research, please cite our work:
|
|
|
|
| 85 |
```bibtex
|
| 86 |
-
@
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 94 |
}
|
| 95 |
```
|
| 96 |
|
| 97 |
-
## Other versions
|
| 98 |
Alongside this pretrained checkpoint, we release decontaminated versions to enable fair
|
| 99 |
zero-shot evaluation on specific benchmarks by excluding their data from pretraining:
|
| 100 |
- [TiRex-2-g](https://huggingface.co/NX-AI/TiRex-2-gifteval-zs): excludes any overlap with
|
|
@@ -105,4 +207,12 @@ zero-shot evaluation on specific benchmarks by excluding their data from pretrai
|
|
| 105 |
in the pretraining corpus (for comparison against TiRex-2-g).
|
| 106 |
- [TiRex-2-f](https://huggingface.co/NX-AI/TiRex-2-fevbench): excludes all
|
| 107 |
[fev-bench eval datasets](https://huggingface.co/datasets/autogluon/fev_datasets)
|
| 108 |
-
from pretraining, using the same approach as for GiftEval.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
library_name: tirex-2
|
| 7 |
license: apache-2.0
|
| 8 |
---
|
| 9 |
+
<div align="center" class="flex items-baseline justify-center gap-2">
|
| 10 |
<img src="tirex.svg" alt="TiRex mascot" width="33" height="40" />
|
| 11 |
<h1 class="m-0">TiRex-2: Generalizing TiRex to Multivariate Data and Streaming</h1>
|
| 12 |
</div>
|
| 13 |
|
| 14 |
+
<p align="center">
|
| 15 |
+
<a href="https://arxiv.org/abs/2607.01204"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/static/v1?label=Paper&message=2607.01204&color=B31B1B&logo=arXiv" alt="Paper"></a>
|
| 16 |
+
<a href="https://github.com/NX-AI/tirex-2"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/badge/GitHub-NX--AI%2Ftirex--2-181717?logo=github" alt="GitHub"></a>
|
| 17 |
+
<a href="https://pypi.org/project/tirex-2/"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/pypi/v/tirex-2?color=blue" alt="PyPI"></a>
|
| 18 |
+
<a href="https://pepy.tech/projects/tirex-2"><img style="margin:2px 0;display:inline-block" src="https://static.pepy.tech/personalized-badge/tirex-2?period=total&units=INTERNATIONAL_SYSTEM&left_color=GREY&right_color=BLUE&left_text=downloads" alt="PyPI Downloads"></a>
|
| 19 |
+
<a href="https://github.com/NX-AI/tirex-2/pkgs/container/tirex2-cpu"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/badge/GHCR-tirex2--cpu%20%2F%20tirex2--gpu-2496ED?logo=docker&logoColor=white" alt="Docker"></a>
|
| 20 |
+
<a href="https://huggingface.co/NX-AI/TiRex-2/blob/main/LICENSE"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License"></a>
|
| 21 |
+
<a href="https://nx-ai.github.io/tirex-2/"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/website?url=https%3A%2F%2Fnx-ai.github.io%2Ftirex-2%2F&label=docs&up_message=online&up_color=green&down_message=offline&down_color=red" alt="docs"></a>
|
| 22 |
+
<a href="https://colab.research.google.com/github/NX-AI/tirex-2/blob/main/examples/getting_started.ipynb"><img style="margin:2px 0;display:inline-block" src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a>
|
| 23 |
+
<a href="https://huggingface.co/spaces/NX-AI/TiRex-2-demo"><img style="margin:2px 0;display:inline-block" src="https://img.shields.io/badge/HuggingFace-TiRex--2%20Demo-yellow?logo=huggingface" alt="TiRex-2 Demo"></a>
|
| 24 |
+
</p>
|
| 25 |
|
| 26 |
+
> [!NOTE]
|
| 27 |
+
> 🎉 **News (Sep 2026):** TiRex-2 has been accepted as an **Oral** presentation (0.36%) at **NeurIPS 2026**!
|
| 28 |
+
|
| 29 |
+
This repository provides the pre-trained multivariate forecasting model TiRex-2 introduced in the paper [TiRex-2: Generalizing TiRex to Multivariate Data and Streaming](https://arxiv.org/abs/2607.01204).
|
| 30 |
+
|
| 31 |
+
> **TiRex-2 PRO:** This repository is our open-source release. TiRex-2 PRO extends it with dedicated support, streaming, hardware-optimized inference (edge, embedded, and industrial PCs, among others), fine-tuning, and classification & regression support — see [TiRex-2 PRO](#tirex-2-pro) below or contact us at [contact@nx-ai.com](mailto:contact@nx-ai.com).
|
| 32 |
+
|
| 33 |
+
## TiRex-2
|
| 34 |
+
|
| 35 |
+
TiRex-2 is a **pretrained time series foundation model** that forecasts one or many target
|
| 36 |
variates directly from their history, optionally conditioned on past and future-known
|
| 37 |
+
covariates. A single checkpoint serves both univariate and multivariate forecasting, built
|
| 38 |
+
on a recurrent architecture designed for efficient streaming settings — all zero-shot, with
|
| 39 |
+
no task-specific training or fine-tuning.
|
| 40 |
|
| 41 |
+
TiRex-2 generalizes our original univariate model, [TiRex](https://github.com/NX-AI/tirex), to
|
| 42 |
multivariate forecasting with past and future covariates.
|
| 43 |
|
| 44 |
## Key facts
|
| 45 |
|
| 46 |
+
- **Zero-shot multivariate forecasting**:
|
| 47 |
+
TiRex-2 forecasts multiple target variates out of the box, without training or fine-tuning on your data.
|
| 48 |
|
| 49 |
- **Past and future-known covariates**:
|
| 50 |
TiRex-2 natively conditions on past covariates and future-known covariates, such as
|
|
|
|
| 54 |
TiRex-2 activates 38.4M parameters in univariate mode and an additional 44.1M parameters
|
| 55 |
for multivariate forecasting.
|
| 56 |
|
| 57 |
+
## Documentation
|
| 58 |
+
|
| 59 |
+
The full documentation, including how-to guides, deployment and the API reference, is available at https://nx-ai.github.io/tirex-2/.
|
| 60 |
|
| 61 |
+
## Installation
|
|
|
|
| 62 |
|
| 63 |
+
Requires Python 3.11 or newer. Install [PyTorch](https://pytorch.org/get-started/locally/) for your CPU or GPU, then TiRex-2:
|
| 64 |
|
| 65 |
```bash
|
| 66 |
+
pip install tirex-2
|
|
|
|
|
|
|
|
|
|
| 67 |
```
|
| 68 |
|
| 69 |
+
## Model files
|
| 70 |
+
|
| 71 |
+
This repository provides the TiRex-2 weights in several formats:
|
| 72 |
+
|
| 73 |
+
| File | Format | Notes |
|
| 74 |
+
| --- | --- | --- |
|
| 75 |
+
| [`model.safetensors`](https://huggingface.co/NX-AI/TiRex-2/blob/main/model.safetensors) + [`config.json`](https://huggingface.co/NX-AI/TiRex-2/blob/main/config.json) | [safetensors](https://github.com/huggingface/safetensors) | **Default.** Loaded by `load_model("NX-AI/TiRex-2")`, including in the Docker images. Avoids unpickling and loads faster. |
|
| 76 |
+
| [`model.onnx`](https://huggingface.co/NX-AI/TiRex-2/blob/main/model.onnx) | ONNX | Run with only `numpy` and `onnxruntime`, no PyTorch needed. See the [ONNX guide](https://nx-ai.github.io/tirex-2/how-to/onnx/). |
|
| 77 |
+
| `model.ckpt` + `model-config.yaml` | PyTorch checkpoint | Legacy format, kept for older releases. Not supported by `tirex-2` 0.5.0 and later; use `tirex-2<0.5.0` if you need it. |
|
| 78 |
+
|
| 79 |
+
## FAQ
|
| 80 |
+
|
| 81 |
+
See the [FAQ](https://nx-ai.github.io/tirex-2/faq/) in the documentation.
|
| 82 |
+
|
| 83 |
+
## Agent plugin
|
| 84 |
+
|
| 85 |
+
Forecast time series without training or writing code in Claude Code or Codex using the TiRex-2 plugin:
|
| 86 |
+
|
| 87 |
+
**Claude Code**
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
claude plugin marketplace add NX-AI/tirex-2
|
| 91 |
+
claude plugin install tirex2@tirex2-plugins
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
**Codex**
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
codex plugin marketplace add NX-AI/tirex-2
|
| 98 |
+
codex plugin add tirex2@tirex2-plugins
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Start a new session and ask to forecast with TiRex-2.
|
| 102 |
+
|
| 103 |
+
## Getting started
|
| 104 |
+
|
| 105 |
+
The most easy way for you to get started is by checking out our ["Getting Started" notebook](https://github.com/NX-AI/tirex-2/blob/main/examples/getting_started.ipynb). Moreover, you can jump straight into testing out TiRex-2 using [Google Colab](https://colab.research.google.com/github/NX-AI/tirex-2/blob/main/examples/getting_started.ipynb). If you have cloned this repository, you can also easily start the notebook via [Pixi](https://pixi.prefix.dev/latest/#installation) by running:
|
| 106 |
+
```bash
|
| 107 |
+
pixi run notebook
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
### Minimal usage predicting a simple sine wave
|
| 111 |
```python
|
| 112 |
+
import torch
|
| 113 |
from tirex2 import TimeseriesType, load_model
|
| 114 |
+
from tirex2.plotting import plot_multivariate # requires matplotlib to be installed
|
| 115 |
+
|
| 116 |
+
# load model
|
| 117 |
+
model = load_model("NX-AI/TiRex-2", device="cpu") # use `device="cuda"` if cuda is available
|
| 118 |
+
|
| 119 |
+
# generate data - target expects time series of shape (n_targets, context_length)
|
| 120 |
+
context = torch.sin(torch.arange(128).float() / 8)
|
| 121 |
+
ts = TimeseriesType(target=context.unsqueeze(0), past_covariates=None, future_covariates=None)
|
| 122 |
+
|
| 123 |
+
# perform forecast - each forecast is of shape (n_targets, 9 quantiles, prediction_length)
|
| 124 |
+
forecast = model.forecast([ts], prediction_length=32, output_type="numpy")[0]
|
| 125 |
+
|
| 126 |
+
# visualize result
|
| 127 |
+
fig = plot_multivariate(ts, forecast, engine="matplotlib")
|
| 128 |
+
fig.show()
|
| 129 |
+
```
|
| 130 |
+

|
| 131 |
+
|
| 132 |
+
### Covariate example
|
| 133 |
+
This example originates from the "Getting Started" notebook, showing the value of additional covariates.
|
| 134 |
+
```python
|
| 135 |
+
from tirex2 import load_model
|
| 136 |
+
from tirex2.demo import Demo, plot_demo_forecast
|
| 137 |
|
| 138 |
+
# load model
|
| 139 |
model = load_model("NX-AI/TiRex-2", device="cpu") # use `device="cuda"` if cuda is available
|
| 140 |
+
|
| 141 |
+
# load data
|
| 142 |
+
demo = Demo.create_nonstationary_demo()
|
| 143 |
+
ts_univariate = demo.to_timeseries_type(include_covariates=False)
|
| 144 |
+
ts_multivariate = demo.to_timeseries_type(include_covariates=True)
|
| 145 |
+
|
| 146 |
+
# perform forecast - each forecast is of shape (n_targets, 9 quantiles, prediction_length)
|
| 147 |
+
forecasts = model.forecast(
|
| 148 |
+
timeseries=[ts_univariate, ts_multivariate],
|
| 149 |
+
prediction_length=demo.horizon,
|
| 150 |
+
output_type="numpy",
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
# visualize result
|
| 154 |
+
fig = plot_demo_forecast(demo, *forecasts, engine="matplotlib")
|
| 155 |
+
fig.show()
|
| 156 |
```
|
| 157 |
+

|
| 158 |
+
|
| 159 |
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
### Benchmarking
|
| 162 |
+
To reproduce our results for the [GIFT-Eval](https://huggingface.co/spaces/Salesforce/GIFT-Eval) and [fev-bench](https://huggingface.co/spaces/autogluon/fev-bench) leaderboards, follow the instructions in
|
| 163 |
+
[examples/gifteval](https://github.com/NX-AI/tirex-2/blob/main/examples/gifteval/README.md) and [examples/fevbench](https://github.com/NX-AI/tirex-2/blob/main/examples/fevbench/README.md), respectively.
|
| 164 |
|
| 165 |
+
## TiRex-2 Docker image
|
| 166 |
+
|
| 167 |
+
For detailed instructions on building and running TiRex-2 in a Docker container, see the [Docker README](https://github.com/NX-AI/tirex-2/blob/main/inference/README.md).
|
| 168 |
+
|
| 169 |
+
## TiRex-2 PRO
|
| 170 |
TiRex-2 already provides state-of-the-art performance for zero-shot prediction, so you can use this open-source release without training on your own data.
|
| 171 |
|
| 172 |
+
TiRex-2 PRO extends this open-source release with:
|
| 173 |
|
| 174 |
+
- **Support**: dedicated support and engagement from NXAI.
|
| 175 |
+
- **Streaming**: incremental forecast updates as new observations arrive, without recomputing forecasts over the full history.
|
| 176 |
+
- **Speed**: optimized inference, including hardware-specific optimizations for edge, embedded, and industrial PC deployments.
|
| 177 |
+
- **Fine-tuning**: models adapted to your data or pretrained on different datasets for improved performance.
|
| 178 |
- **Classification & Regression**: TiRex-2 adapted for classification and regression tasks.
|
| 179 |
|
| 180 |
+
See the full feature comparison in the [docs](https://nx-ai.github.io/tirex-2/pro/), or contact us at [contact@nx-ai.com](mailto:contact@nx-ai.com).
|
| 181 |
|
| 182 |
## Cite
|
| 183 |
+
|
| 184 |
If you use TiRex-2 in your research, please cite our work:
|
| 185 |
+
|
| 186 |
```bibtex
|
| 187 |
+
@inproceedings{podest2026tirex2,
|
| 188 |
+
title = {{TiRex-2}: Generalizing {TiRex} to Multivariate Data and Streaming},
|
| 189 |
+
author = {Podest, Patrick and Pichler, Marco and B{\"u}rger, Elias and Z{\'o}lyomi, Levente and Voggenberger, Bernhard and Berghammer, Wilhelm and Klotz, Daniel and B{\"o}ck, Sebastian and Klambauer, G{\"u}nter and Hochreiter, Sepp},
|
| 190 |
+
booktitle = {Advances in Neural Information Processing Systems},
|
| 191 |
+
year = {2026},
|
| 192 |
+
eprint = {2607.01204},
|
| 193 |
+
archivePrefix = {arXiv},
|
| 194 |
+
primaryClass = {cs.LG},
|
| 195 |
+
url = {https://arxiv.org/abs/2607.01204}
|
| 196 |
}
|
| 197 |
```
|
| 198 |
|
| 199 |
+
## Other versions
|
| 200 |
Alongside this pretrained checkpoint, we release decontaminated versions to enable fair
|
| 201 |
zero-shot evaluation on specific benchmarks by excluding their data from pretraining:
|
| 202 |
- [TiRex-2-g](https://huggingface.co/NX-AI/TiRex-2-gifteval-zs): excludes any overlap with
|
|
|
|
| 207 |
in the pretraining corpus (for comparison against TiRex-2-g).
|
| 208 |
- [TiRex-2-f](https://huggingface.co/NX-AI/TiRex-2-fevbench): excludes all
|
| 209 |
[fev-bench eval datasets](https://huggingface.co/datasets/autogluon/fev_datasets)
|
| 210 |
+
from pretraining, using the same approach as for GiftEval.
|
| 211 |
+
|
| 212 |
+
## Intended use and limitations
|
| 213 |
+
|
| 214 |
+
This release supports time-series forecasting as [documented](https://nx-ai.github.io/tirex-2/). High-risk applications under EU AI Act Article 6 are outside NXAI's intended purpose. NXAI has not validated this release for high-risk compliance. Users and integrators must assess suitability and meet their legal obligations. Unlawful uses, including those prohibited by EU AI Act Article 5, are not permitted. See the [Intended Use Notice](https://github.com/NX-AI/tirex-2/blob/main/INTENDED_USE.md) for details. It does not change the licence or statutory obligations.
|
| 215 |
+
|
| 216 |
+
## License
|
| 217 |
+
|
| 218 |
+
TiRex-2 is licensed under the [Apache License 2.0](https://huggingface.co/NX-AI/TiRex-2/blob/main/LICENSE).
|