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
File size: 12,250 Bytes
fba6f9f 35bde0d fba6f9f 35bde0d fba6f9f 4bf2abf 3717105 fba6f9f 4bf2abf 874af56 4bf2abf a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 2a5249a fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 282c692 a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 fba6f9f a8d6140 2a5249a a8d6140 2a5249a a8d6140 05e5b26 a8d6140 2a5249a fba6f9f a8d6140 fba6f9f a8d6140 45b9cfa a8d6140 45b9cfa fba6f9f a8d6140 45b9cfa a8d6140 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | ---
datasets:
- autogluon/chronos_datasets
- Salesforce/lotsa_data
pipeline_tag: time-series-forecasting
library_name: tirex-2
license: apache-2.0
---
<div align="center" class="flex items-baseline justify-center gap-2">
<img src="tirex.svg" alt="TiRex mascot" width="33" height="40" />
<h1 class="m-0">TiRex-2: Generalizing TiRex to Multivariate Data and Streaming</h1>
</div>
<p align="center">
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
</p>
> [!NOTE]
> 🎉 **News (Sep 2026):** TiRex-2 has been accepted as an **Oral** presentation (0.36%) at **NeurIPS 2026**!
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).
> **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).
## TiRex-2
TiRex-2 is a **pretrained time series foundation model** that forecasts one or many target
variates directly from their history, optionally conditioned on past and future-known
covariates. A single checkpoint serves both univariate and multivariate forecasting, built
on a recurrent architecture designed for efficient streaming settings — all zero-shot, with
no task-specific training or fine-tuning.
TiRex-2 generalizes our original univariate model, [TiRex](https://github.com/NX-AI/tirex), to
multivariate forecasting with past and future covariates.
## Key facts
- **Zero-shot multivariate forecasting**:
TiRex-2 forecasts multiple target variates out of the box, without training or fine-tuning on your data.
- **Past and future-known covariates**:
TiRex-2 natively conditions on past covariates and future-known covariates, such as
calendar features, holidays, promotions, or scheduled interventions.
- **Small active footprint**:
TiRex-2 activates 38.4M parameters in univariate mode and an additional 44.1M parameters
for multivariate forecasting.
## Documentation
The full documentation, including how-to guides, deployment and the API reference, is available at https://nx-ai.github.io/tirex-2/.
## Installation
Requires Python 3.11 or newer. Install [PyTorch](https://pytorch.org/get-started/locally/) for your CPU or GPU, then TiRex-2:
```bash
pip install tirex-2
```
## Model files
This repository provides the TiRex-2 weights in several formats:
| File | Format | Notes |
| --- | --- | --- |
| [`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. |
| [`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/). |
| `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. |
## FAQ
See the [FAQ](https://nx-ai.github.io/tirex-2/faq/) in the documentation.
## Agent plugin
Forecast time series without training or writing code in Claude Code or Codex using the TiRex-2 plugin:
**Claude Code**
```bash
claude plugin marketplace add NX-AI/tirex-2
claude plugin install tirex2@tirex2-plugins
```
**Codex**
```bash
codex plugin marketplace add NX-AI/tirex-2
codex plugin add tirex2@tirex2-plugins
```
Start a new session and ask to forecast with TiRex-2.
## Getting started
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:
```bash
pixi run notebook
```
### Minimal usage predicting a simple sine wave
```python
import torch
from tirex2 import TimeseriesType, load_model
from tirex2.plotting import plot_multivariate # requires matplotlib to be installed
# load model
model = load_model("NX-AI/TiRex-2", device="cpu") # use `device="cuda"` if cuda is available
# generate data - target expects time series of shape (n_targets, context_length)
context = torch.sin(torch.arange(128).float() / 8)
ts = TimeseriesType(target=context.unsqueeze(0), past_covariates=None, future_covariates=None)
# perform forecast - each forecast is of shape (n_targets, 9 quantiles, prediction_length)
forecast = model.forecast([ts], prediction_length=32, output_type="numpy")[0]
# visualize result
fig = plot_multivariate(ts, forecast, engine="matplotlib")
fig.show()
```

### Covariate example
This example originates from the "Getting Started" notebook, showing the value of additional covariates.
```python
from tirex2 import load_model
from tirex2.demo import Demo, plot_demo_forecast
# load model
model = load_model("NX-AI/TiRex-2", device="cpu") # use `device="cuda"` if cuda is available
# load data
demo = Demo.create_nonstationary_demo()
ts_univariate = demo.to_timeseries_type(include_covariates=False)
ts_multivariate = demo.to_timeseries_type(include_covariates=True)
# perform forecast - each forecast is of shape (n_targets, 9 quantiles, prediction_length)
forecasts = model.forecast(
timeseries=[ts_univariate, ts_multivariate],
prediction_length=demo.horizon,
output_type="numpy",
)
# visualize result
fig = plot_demo_forecast(demo, *forecasts, engine="matplotlib")
fig.show()
```

### Benchmarking
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
[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.
## TiRex-2 Docker image
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).
## TiRex-2 PRO
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.
TiRex-2 PRO extends this open-source release with:
- **Support**: dedicated support and engagement from NXAI.
- **Streaming**: incremental forecast updates as new observations arrive, without recomputing forecasts over the full history.
- **Speed**: optimized inference, including hardware-specific optimizations for edge, embedded, and industrial PC deployments.
- **Fine-tuning**: models adapted to your data or pretrained on different datasets for improved performance.
- **Classification & Regression**: TiRex-2 adapted for classification and regression tasks.
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).
## Cite
If you use TiRex-2 in your research, please cite our work:
```bibtex
@inproceedings{podest2026tirex2,
title = {{TiRex-2}: Generalizing {TiRex} to Multivariate Data and Streaming},
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},
booktitle = {Advances in Neural Information Processing Systems},
year = {2026},
eprint = {2607.01204},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2607.01204}
}
```
## Other versions
Alongside this pretrained checkpoint, we release decontaminated versions to enable fair
zero-shot evaluation on specific benchmarks by excluding their data from pretraining:
- [TiRex-2-g](https://huggingface.co/NX-AI/TiRex-2-gifteval-zs): excludes any overlap with
the GiftEval datasets ([pretrain](https://huggingface.co/datasets/Salesforce/GiftEvalPretrain)
and [evaluation](https://huggingface.co/datasets/Salesforce/GiftEval)) from pretraining.
- [TiRex-2-gp](https://huggingface.co/NX-AI/TiRex-2-gifteval-pretrain): includes the
[GiftEval-Pretrain collection](https://huggingface.co/datasets/Salesforce/GiftEvalPretrain)
in the pretraining corpus (for comparison against TiRex-2-g).
- [TiRex-2-f](https://huggingface.co/NX-AI/TiRex-2-fevbench): excludes all
[fev-bench eval datasets](https://huggingface.co/datasets/autogluon/fev_datasets)
from pretraining, using the same approach as for GiftEval.
## Intended use and limitations
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.
## License
TiRex-2 is licensed under the [Apache License 2.0](https://huggingface.co/NX-AI/TiRex-2/blob/main/LICENSE).
|