Metadata-Version: 2.4
Name: tirex-2
Version: 0.1.0
Summary: TiRex-2 time series forecasting inference
Author-email: Patrick Podest <podest@ml.jku.at>, Levente Zolyomi <levente.zolyomi@nx-ai.com>
License: Apache-2.0
Requires-Python: <3.14,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: torch<2.10,>=2.8
Requires-Dist: numpy~=2.1.3
Requires-Dist: einops~=0.8.1
Requires-Dist: flashrnn>=1.0.4
Requires-Dist: xlstm~=2.0.3
Requires-Dist: PyYAML>=6
Requires-Dist: huggingface-hub~=0.32.0
Provides-Extra: examples
Requires-Dist: matplotlib>=3.10.0; extra == "examples"
Requires-Dist: jupyterlab; extra == "examples"
Provides-Extra: fev
Requires-Dist: fev; extra == "fev"
Requires-Dist: datasets==3.6.0; extra == "fev"
Requires-Dist: pyarrow>=21.0.0; extra == "fev"
Provides-Extra: gluonts
Requires-Dist: gluonts>=0.16.2; extra == "gluonts"
Requires-Dist: pandas~=2.2.3; extra == "gluonts"
Dynamic: license-file

<h1 align="center">
  <img src="docs/images/tirex.svg" alt="TiRex emoji" height="48" /> TiRex-2: Generalizing TiRex to Multivariate Data and Streaming
</h1>

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

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 and
operates in a streaming fashion as new observations arrive — all zero-shot, with no
task-specific training or fine-tuning.

### Key facts

- **Zero-shot multivariate forecasting**:
  TiRex-2 forecasts multiple target variates out of the box, without training or fine-tuning on you 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.


# Getting started

The environment is managed by [Pixi](https://pixi.prefix.dev/latest/). Run the following to install it on your machine

```bash
curl -fsSL https://pixi.sh/install.sh | sh
git clone https://github.com/NX-AI/tirex-2 && cd tirex-2
# activate the cpu-only env
eval "$(pixi shell-hook -e example)"  # to execute on GPUs use `example-cu128` or `example-cu126`
```

Minimal usage predicting a simple sine wave:
```python
import matplotlib.pyplot as plt, torch
from tirex2 import TimeseriesType, load_model

model = load_model("NX-AI/TiRex-2", device="cpu")  # use `device="cuda"` if cuda is available
y = torch.sin(torch.arange(160).float() / 8)
ts = TimeseriesType(target=y[:128].unsqueeze(0), past_covariates=None, future_covariates=None)
forecast = model.forecast([ts], prediction_length=32, output_type="numpy")[0][0]
```

We provide predefined Pixi tasks showcasing examplary forecasts. These run in the CPU-only `example` environment by default:
- `pixi run minimal` runs above code and creates a plot of the forecast.
- `pixi run comparison` showcases the additional benefit of future known covariates in forecasting a target.

For a more interactive demo of TiRex-2, we also provide a [quick-start](./examples/getting_started.ipynb) notebook.

To reproduce our results for GIFT-Eval and fev-bench follow the instructions in
[./examples/gifteval/](./examples/gifteval/README.md) or [./examples/fevbench/](./examples/fevbench/README.md),
respectively.

## Cite

If you use TiRex in your research, please cite our work:

```bibtex
@misc{podest2026tirex2generalizingtirexmultivariate,
      title={TiRex-2: Generalizing TiRex to Multivariate Data and Streaming}, 
      author={Patrick Podest and Marco Pichler and Elias Bürger and Levente Zólyomi and Bernhard Voggenberger and Wilhelm Berghammer and Daniel Klotz and Sebastian Böck and Günter Klambauer and Sepp Hochreiter},
      year={2026},
      eprint={2607.01204},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2607.01204}, 
}
```
