Back to models
Forecaster

TimerForecaster

Categorical featuresIn-sample prediction intervals

Timer foundation model forecaster.

Wraps the Timer generative pre-trained Transformer for zero-shot time series forecasting via the HuggingFace transformers library.

Timer uses autoregressive generation on continuous time series tokens. The model is pre-trained on the Unified Time Series Dataset (UTSD) covering diverse domains and temporal patterns.

The model is cached using the multiton pattern to avoid reloading weights when multiple forecaster instances share the same model.

Quickstart

python
from sktime.forecasting.timer import TimerForecaster

estimator = TimerForecaster(model_name='thuml/timer-base-84m', context_length=2880, device='cpu')

Tags

Capabilities

  • Categorical features
  • In-sample prediction intervals: Supported
  • In-sample predictions: Not supported
  • Prediction intervals: Not supported
  • Missing values: Not supported
  • Exogenous variables: Not supported
  • Multivariate: Not supported

Properties

Needs forecast horizon in fitrequires-fh-in-fit
No
X and y need the same indexX-y-must-have-same-index
Yes

Parameters(3)

model_namestr, default=”thuml/timer-base-84m”

Name or path of the pre-trained Timer model on HuggingFace. Options include:

  • “thuml/timer-base-84m” (84M parameters)

  • “thuml/timer-xl-84m” (Timer-XL variant)

context_lengthint, default=2880
Number of historical observations to use as input context. Timer supports variable context lengths. If the series is shorter, the full series is used.
devicestr, default=”cpu”

Device to run the model on. Options include "cpu", "cuda", "cuda:0", and "auto". "auto" is passed to transformers device_map and selects an available accelerator.

Examples

>>> from sktime.forecasting.timer import TimerForecaster
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> forecaster = TimerForecaster (
... model_name = "thuml/timer-base-84m",
... )
>>> forecaster. fit (y)
>>> y_pred = forecaster. predict (fh = [1, 2, 3 ])

References

[1]

Liu et al., “Timer: Generative Pre-trained Transformers Are Large Time Series Models”, ICML 2024. https://arxiv.org/abs/2402.02368

[2]

Liu et al., “Timer-XL: Long-Context Transformers for Unified Time Series Forecasting”, ICLR 2025.