Skip to main content

Disclaimer

This is a personal fork of tirex, maintained to support custom changes for timecopilot and publish pypi wheels at timecopilot-tirex. It may diverge from upstream.

Credits

This project is a fork of by Original Author(s).
All credit for the original code belongs to them. This fork is maintained independently to support TimeCopilot-specific changes.

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.

ONNX Model

TiRex is available as an ONNX model for optimized inference across different hardware platforms and frameworks. See the ONNX notebook for more details.

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 contact@nx-ai.com

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.

Metadata

Release files for timecopilot-tirex 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timecopilot-tirex 0.1.1
File Size Uploaded
timecopilot_tirex-0.1.1.tar.gz 56.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timecopilot-tirex 0.1.1
File Interpreter ABI Platform
timecopilot_tirex-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 117.5 kB

Release files / timecopilot_tirex-0.1.1.tar.gz

Download URL timecopilot_tirex-0.1.1.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c493aff2d29d1fb7a4c3a5a2642df67030691744cc1ae79d5ea9583f4b5d8895
BLAKE2b-256 checksum
How to use checksums
4a062574fe82fb59ba11a8bf589677243cff349061e95912a762558ca46813aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / timecopilot_tirex-0.1.1-py3-none-any.whl

Download URL timecopilot_tirex-0.1.1-py3-none-any.whl
Size 61.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b2403db5274d92d223c178f8c5c3ec7210645b4c884b44d78e7f4c9b8d571ae
BLAKE2b-256 checksum
How to use checksums
e5f3061de0fb9acfeb9866750af60531ae4d5ef6474ccdfa6e37e6b0eff19eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page