Skip to main content

A pre-trained Time Series Forecasting Model based on xLSTM supporting zero-shot forecasting

Project description

TiRex: Zero-Shot Forecasting across Long and Short Horizons

Paper Hugging Face PyPI PyPI Downloads License docs pre-commit formatter: docformatter

This repository provides the pre-trained forecasting model TiRex introduced in the paper TiRex: Zero-Shot Forecasting across Long and Short Horizons with Enhanced In-Context Learning.

TiRex Model

TiRex is a 35M parameter pre-trained time series forecasting model based on xLSTM.

Key Facts:

  • Zero-Shot Forecasting: TiRex is a pre-trained model that performs time series forecasting without requiring any training on your data. Simply download and use it.

  • Quantile Predictions: TiRex provides both point estimates and quantile estimates.

  • State-of-the-art Performance over Long and Short Horizons: TiRex achieves top scores in various time series forecasting benchmarks, see GiftEval and ChronosZS. These benchmark show that TiRex provides great performance for both long and short-term forecasting.

Documentation

A detailed documentation of TiRex can be found here: https://nx-ai.github.io/tirex/

Installation

pip install tirex-ts

Install with additional input/output adapter:

pip install "tirex-ts[gluonts,hfdataset]"

You can also install TiRex with all extras at once using:

pip install "tirex-ts[all]"

TiRex is currently only tested on Linux and MacOS.

Quick Start

import torch
from tirex import load_model, ForecastModel

model: ForecastModel = load_model("NX-AI/TiRex")
data = torch.rand((5, 128))  # Sample Data (5 time series with length 128)
quantiles, mean = model.forecast(context=data, prediction_length=64)

We provide an extended quick start example in examples/quick_start_tirex.ipynb. This notebook also shows how to use the different input and output types of you time series data. You can also run it in Google Colab.

We provide notebooks to run the benchmarks: GiftEval and Chronos-ZS.

TiRex Classification Model

Paper

For detailed instructions on using TiRex classification model please visit our documentation page and quick start Notebook.

TiRex Regression Model

For detailed instructions on using TiRex regression model please visit our documentation page or our quick start Notebook.

TiRex Docker image

For detailed instructions on building and running TiRex in a Docker container, see the Docker README or our deployment documentation.

Finetuning TiRex

TiRex already provide state-of-the-art performance for zero-shot prediction. Hence, you can use it without training on your own data.

If you are interested in models fine-tuned on your data or with different pretraining, please contact us at [email protected]

CUDA Kernels

Tirex can use custom CUDA kernels for the sLSTM cells. These CUDA kernels are compiled when the model is loaded the first time. The CUDA kernels require GPU hardware that support CUDA compute capability 8.0 or later. We also highly suggest to use the provided conda environment spec. The CUDA kernels are automatically used when the xlstm package is installed.

To install TiRex with the CUDA kernels run:

pip install "tirex-ts[cuda,gluonts,hfdataset]"

Explicitly set the custom CUDA backend:

model = load_model("NX-AI/TiRex", backend="cuda")

Troubleshooting CUDA

This information is taken from the xLSTM repository - See this for further details:

For the CUDA version of sLSTM, you need to specify Compute Capability, see https://developer.nvidia.com/cuda-gpus. Or just specify a range as in the example below:

export TORCH_CUDA_ARCH_LIST="8.0;8.6;9.0"

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:

export XLSTM_EXTRA_INCLUDE_PATHS='/usr/local/include/cuda/:/usr/include/cuda/'

or within python:

import os
os.environ['XLSTM_EXTRA_INCLUDE_PATHS']='/usr/local/include/cuda/:/usr/include/cuda/'

Cite

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

@inproceedings{auer:25tirex,
  title = {{{TiRex}}: {{Zero-Shot Forecasting Across Long}} and {{Short Horizons}} with {{Enhanced In-Context Learning}}},
  author = {Andreas Auer and Patrick Podest and Daniel Klotz and Sebastian B{\"o}ck and G{\"u}nter Klambauer and Sepp Hochreiter},
  booktitle = {The Thirty-Ninth Annual Conference on Neural Information Processing Systems},
  year = {2025}
  url = {https://arxiv.org/abs/2505.23719},
}
@inproceedings{auer:25tirexclassification,
    title = {Pre-trained Forecasting Models: Strong Zero-Shot Feature Extractors for Time Series Classification},
    author = {Andreas Auer and Daniel Klotz and Sebastinan B{\"o}ck and Sepp Hochreiter},
    booktitle = {NeurIPS 2025 Workshop on Recent Advances in Time Series Foundation Models (BERT2S)},
    year = {2025},
    url = {https://arxiv.org/abs/2510.26777},
}

License

TiRex is licensed under the NXAI community license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tirex_ts-1.4.0.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tirex_ts-1.4.0-py3-none-any.whl (60.5 kB view details)

Uploaded Python 3

File details

Details for the file tirex_ts-1.4.0.tar.gz.

File metadata

  • Download URL: tirex_ts-1.4.0.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tirex_ts-1.4.0.tar.gz
Algorithm Hash digest
SHA256 2d4c86a9e664978eb0dd3dc3c5c6535cc7054670bf67c36022f20f9256150319
MD5 85a48eba81efd1e2e632b18c5713af7a
BLAKE2b-256 fc4234d75f510f797e7fb7cc23dacf40c739f58b27997efa049640049b55b79f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tirex_ts-1.4.0.tar.gz:

Publisher: publish.yaml on NX-AI/tirex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tirex_ts-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: tirex_ts-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 60.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tirex_ts-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 456408ba9a07a04ac8cf7df418f3d9a66c76c7b4730dba570fa35375e611ea31
MD5 aca87871952486ee8b6125f185f36e5d
BLAKE2b-256 b4742bd9d0ee0a661917a445e1d46e51971c6ee27cb0ab235451c238d52e783a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tirex_ts-1.4.0-py3-none-any.whl:

Publisher: publish.yaml on NX-AI/tirex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page