Skip to main content

The Forecasting Company

t0

PyPI Python versions License

Open-weights time-series forecasting foundation model from The Forecasting Company. t0 is a transformer-based model that produces probabilistic multi-horizon forecasts and natively operates on multiple covariates. t0-alpha is our first iteration of the model.

You can use t0 on Retrocast, our platform for forecasting on your own data. You can also compare forecast across different open-weight models.

t0 forecasting French national electricity demand in Retrocast

t0 forecasting French national electricity demand in Retrocast. Data: Enedis open data.

📈 Forecasting with covariates

t0 leverages covariate information, in the past and future when available, to improve its forecast.

Without covariates With covariates
t0 forecast without covariates t0 forecast with covariates

Data: Medic'AM, monthly drug reimbursements from the French national health insurance.

The Quickstart below shows the API for both a plain univariate forecast and a multivariate forecast that conditions on historical and known-future covariates.

🚀 Quickstart

pip install tfc-t0

The simplest path is a univariate forecast through predict:

import torch
from t0 import T0Forecaster

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

context = torch.randn(4, 512)  # 4 series, 512 past timesteps
out = model.predict(context, horizon=64, quantiles=[0.1, 0.5, 0.9])
out.quantiles  # (4, 64, 3)
out.median     # (4, 64)

predict accepts numpy arrays. 1-D contexts are auto-promoted to a single-row batch. NaN in the context is read as a missing observation; to say that some cells are padding instead, pass a mask — see batched inference.

Forecasting with covariates

Anything you know over the past goes in context — alongside the target, extra variates attend to it and are forecast together. Anything you know over the future (calendar features, planned promotions, weather forecasts) goes in future_covariates, shaped [B, F, context + horizon]; the model conditions on it but does not forecast it.

import torch
from t0 import T0Forecaster

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

context = torch.randn(2, 512)                    # 2 series, 512 past timesteps
future_covariates = torch.randn(2, 3, 512 + 64)  # 3 covariates known over context + horizon

out = model.predict(
    context,
    horizon=64,
    quantiles=[0.1, 0.5, 0.9],
    future_covariates=future_covariates,
)
out.quantiles  # (2, 64, 3)
out.median     # (2, 64)

Batched inference

import numpy as np
from t0 import T0Forecaster, batch_series

model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()

daily = np.random.randn(180)    # one series, 180 past timesteps
store = np.random.randn(2, 96)  # one series of 2 variates, 96 past timesteps
hourly = np.random.randn(1024)  # one series, 1024 past timesteps

context, mask, group_ids = batch_series([daily, store, hourly])
context.shape  # (4, 1024) — variates stacked, right-aligned to the longest
group_ids      # [0, 1, 1, 2] — `store`'s two variates are forecast jointly

out = model.predict(
    context,
    horizon=24,
    quantiles=[0.1, 0.5, 0.9],
    mask=mask,
    group_ids=group_ids,
)
out.quantiles  # (4, 24, 3)
out.median[0]  # the 24-step median forecast for `daily`

For efficient inference at scale, look at Retrocast.

🏗️ Architecture

t0 is a decoder-style patch transformer that alternates time and covariate attention layers. It predicts 5 quantiles (0.1, 0.25, 0.5, 0.75, 0.9), decoding multiple horizons in parallel — up to 1024 timesteps in one forward pass — and falling back on autoregressive rollout for longer horizons.

Parameters ~102M
Layers 24
Embedding dim 512
Feedforward dim 2048
Attention heads 8
Patch size 32
Quantile levels 0.1, 0.25, 0.5, 0.75, 0.9

🧬 Lineage

t0 builds on ideas — and in places, code — from open-source forecasting models. We gratefully acknowledge:

  • Toto by Datadog (repo) & Chronos-2 by Amazon (repo) — factorizing attention in the time and variates dimension.
  • TiRex by NXAI (repo) — contiguous patch masking.

Code-level attributions are listed in NOTICE, all under Apache-2.0.

🧰 Public API

  • T0Forecasternn.Module with from_pretrained / save_pretrained (via huggingface_hub.PyTorchModelHubMixin) and the user-facing predict(context, horizon, quantiles, future_covariates, mask, group_ids).
  • Forecast — the object returned by the model.
  • T0Config — the configuration of the model; T0Config.medium() is the published one.
  • MaskType — the reason a time step is masked out: PAD (a cell that only widens a shorter series out to the batch's width) or MISSING (an absent observation).
  • batch_series — utility to batch time series of potentially different lengths.

📚 Citation

If our model is useful, please use the following citation and star our repo!

@misc{tfc-t0,
  title  = {t0: A time-series forecasting foundation model},
  author = {The Forecasting Company},
  year   = {2026},
  url    = {https://huggingface.co/theforecastingcompany/t0-alpha},
}

⚖️ License

Apache-2.0 — see LICENSE and NOTICE.

Download files

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

Source Distribution

tfc_t0-0.3.1.tar.gz (512.5 kB view details)

Uploaded Source

Built Distribution

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

tfc_t0-0.3.1-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file tfc_t0-0.3.1.tar.gz.

File metadata

  • Download URL: tfc_t0-0.3.1.tar.gz
  • Upload date:
  • Size: 512.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tfc_t0-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5d394680ee956431a79488deb22f61f805b1b675dfd81a554c843da3eabb2aa0
MD5 5b328d3fe6fcab0ad6c2e3936c7b943d
BLAKE2b-256 8776327aef9b98f9eede95c14bfb85c23bb5a28541de3b14391289d803418a41

See more details on using hashes here.

Provenance

The following attestation bundles were made for tfc_t0-0.3.1.tar.gz:

Publisher: release.yml on theforecastingcompany/tfc-t0

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

File details

Details for the file tfc_t0-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: tfc_t0-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tfc_t0-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab7d2074cd330e1f2a931651c8f46dd6884e74591c5a6514de7d7233a84f2ed0
MD5 8d3dd0c7c84ca864355326ffe00b940e
BLAKE2b-256 88909a9b6970f3578ab2f790c5f6ae628b0696b37e51bea55d801af6f4cd4ac2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tfc_t0-0.3.1-py3-none-any.whl:

Publisher: release.yml on theforecastingcompany/tfc-t0

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

Release history Release notifications | RSS feed

0.3.2

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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