Time Series Forecasting
Safetensors
PyTorch
MLX
tfc-t0
time-series
forecasting
probabilistic-forecasting
foundation-models
pretrained-models
transformer
multivariate
known-future-covariates
open-weights
covariates
apple-silicon
model_hub_mixin
pytorch_model_hub_mixin
Eval Results (legacy)
Instructions to use theforecastingcompany/t0-alpha with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use theforecastingcompany/t0-alpha with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir t0-alpha theforecastingcompany/t0-alpha
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Super-squash branch 'main' using huggingface_hub
Browse filesCo-authored-by: LTMeyer <LTMeyer@users.noreply.huggingface.co>
- .gitattributes +38 -0
- README.md +189 -0
- assets/enedis_with_holidays.png +3 -0
- assets/medicam_with_cov.png +3 -0
- assets/medicam_without_cov.png +3 -0
- config.json +17 -0
- model.safetensors +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
assets/enedis_with_holidays.png filter=lfs di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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: time-series-forecasting
|
| 4 |
+
library_name: pytorch
|
| 5 |
+
thumbnail: https://www.theforecastingcompany.com/images/og.png
|
| 6 |
+
tags:
|
| 7 |
+
- time-series
|
| 8 |
+
- forecasting
|
| 9 |
+
- foundation-models
|
| 10 |
+
- pretrained-models
|
| 11 |
+
- safetensors
|
| 12 |
+
model-index:
|
| 13 |
+
- name: t0
|
| 14 |
+
results:
|
| 15 |
+
- task:
|
| 16 |
+
type: time-series-forecasting
|
| 17 |
+
name: Time Series Forecasting
|
| 18 |
+
dataset:
|
| 19 |
+
name: fev-bench
|
| 20 |
+
type: autogluon/fev-bench
|
| 21 |
+
metrics:
|
| 22 |
+
- name: Skill score
|
| 23 |
+
type: skill-score
|
| 24 |
+
value: 42.5
|
| 25 |
+
source:
|
| 26 |
+
name: fev-bench leaderboard
|
| 27 |
+
url: https://huggingface.co/spaces/autogluon/fev-bench
|
| 28 |
+
- task:
|
| 29 |
+
type: time-series-forecasting
|
| 30 |
+
name: Time Series Forecasting
|
| 31 |
+
dataset:
|
| 32 |
+
name: GIFT-Eval
|
| 33 |
+
type: Salesforce/GiftEval
|
| 34 |
+
metrics:
|
| 35 |
+
- name: CRPS
|
| 36 |
+
type: crps
|
| 37 |
+
value: 0.5126
|
| 38 |
+
- name: MASE
|
| 39 |
+
type: mase
|
| 40 |
+
value: 0.7431
|
| 41 |
+
source:
|
| 42 |
+
name: GIFT-Eval leaderboard
|
| 43 |
+
url: https://huggingface.co/spaces/Salesforce/GIFT-Eval
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
<p align="center">
|
| 47 |
+
<img class="dark:hidden" src="https://www.theforecastingcompany.com/logo/logo_horizontal_pride_light.png" alt="The Forecasting Company" width="280" />
|
| 48 |
+
<img class="hidden dark:block" src="https://www.theforecastingcompany.com/logo/logo_horizontal_pride_dark.png" alt="The Forecasting Company" width="280" />
|
| 49 |
+
</p>
|
| 50 |
+
|
| 51 |
+
# `t0`
|
| 52 |
+
|
| 53 |
+
Open-weights time-series forecasting foundation model from [The Forecasting Company](https://theforecastingcompany.com/).
|
| 54 |
+
`t0` is a transformer-based model that
|
| 55 |
+
produces probabilistic multi-horizon forecasts and natively operates on
|
| 56 |
+
multiple covariates. `t0-alpha` is our first iteration of the model.
|
| 57 |
+
|
| 58 |
+
You can use `t0` on [Retrocast](https://app.retrocast.com/), our platform for forecasting on your own data. You can also compare forecast across different open-weight models.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
|
| 62 |
+
_`t0` forecasting French national electricity demand in Retrocast. Data:
|
| 63 |
+
[Enedis open data](https://data.enedis.fr/)._
|
| 64 |
+
|
| 65 |
+
## π Forecasting with covariates
|
| 66 |
+
|
| 67 |
+
`t0` leverages covariate information, in the past and future when
|
| 68 |
+
available, to improve its forecast.
|
| 69 |
+
|
| 70 |
+
| Without covariates | With covariates |
|
| 71 |
+
| ----------------------------------------------------------------- | ----------------------------------------------------------- |
|
| 72 |
+
|  |  |
|
| 73 |
+
|
| 74 |
+
_Data: [Medic'AM](https://www.assurance-maladie.ameli.fr/etudes-et-donnees/medicaments-classe-atc-medicam),
|
| 75 |
+
monthly drug reimbursements from the French national health insurance._
|
| 76 |
+
|
| 77 |
+
The [Quickstart](#-quickstart) below shows the API for both a plain
|
| 78 |
+
univariate forecast and a multivariate forecast that conditions on
|
| 79 |
+
historical and known-future covariates.
|
| 80 |
+
|
| 81 |
+
## π Quickstart
|
| 82 |
+
|
| 83 |
+
```bash
|
| 84 |
+
pip install tfc-t0
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
The simplest path is a univariate forecast through `predict`:
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
import torch
|
| 91 |
+
from t0 import T0Forecaster
|
| 92 |
+
|
| 93 |
+
model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()
|
| 94 |
+
|
| 95 |
+
context = torch.randn(4, 512) # 4 series, 512 past timesteps
|
| 96 |
+
out = model.predict(context, horizon=64, quantiles=[0.1, 0.5, 0.9])
|
| 97 |
+
out.quantiles # (4, 64, 3)
|
| 98 |
+
out.median # (4, 64)
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
`predict` accepts `numpy` arrays. 1-D contexts are auto-promoted to a
|
| 102 |
+
single-row batch. NaN values in the context are treated as missing
|
| 103 |
+
observations.
|
| 104 |
+
|
| 105 |
+
### Forecasting with covariates
|
| 106 |
+
|
| 107 |
+
Anything you know over the **past** goes in `context` β alongside the
|
| 108 |
+
target, extra variates attend to it and are forecast together. Anything
|
| 109 |
+
you know over the **future** (calendar features, planned promotions,
|
| 110 |
+
weather forecasts) goes in `future_covariates`, shaped
|
| 111 |
+
`[B, F, context + horizon]`; the model conditions on it but does not
|
| 112 |
+
forecast it.
|
| 113 |
+
|
| 114 |
+
```python
|
| 115 |
+
import torch
|
| 116 |
+
from t0 import T0Forecaster
|
| 117 |
+
|
| 118 |
+
model = T0Forecaster.from_pretrained("theforecastingcompany/t0-alpha").eval()
|
| 119 |
+
|
| 120 |
+
context = torch.randn(2, 512) # 2 series, 512 past timesteps
|
| 121 |
+
future_covariates = torch.randn(2, 3, 512 + 64) # 3 covariates known over context + horizon
|
| 122 |
+
|
| 123 |
+
out = model.predict(
|
| 124 |
+
context,
|
| 125 |
+
horizon=64,
|
| 126 |
+
quantiles=[0.1, 0.5, 0.9],
|
| 127 |
+
future_covariates=future_covariates,
|
| 128 |
+
)
|
| 129 |
+
out.quantiles # (2, 64, 3)
|
| 130 |
+
out.median # (2, 64)
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
## ποΈ Architecture
|
| 134 |
+
|
| 135 |
+
`t0` is a decoder-style patch transformer that alternates time and
|
| 136 |
+
covariate attention layers. It predicts 5 quantiles (0.1, 0.25, 0.5,
|
| 137 |
+
0.75, 0.9), decoding multiple horizons in parallel β up to 1024
|
| 138 |
+
timesteps in one forward pass β and falling back on autoregressive
|
| 139 |
+
rollout for longer horizons.
|
| 140 |
+
|
| 141 |
+
| | |
|
| 142 |
+
| --------------- | ------------------------- |
|
| 143 |
+
| Parameters | ~102M |
|
| 144 |
+
| Layers | 24 |
|
| 145 |
+
| Embedding dim | 512 |
|
| 146 |
+
| Feedforward dim | 2048 |
|
| 147 |
+
| Attention heads | 8 |
|
| 148 |
+
| Patch size | 32 |
|
| 149 |
+
| Quantile levels | 0.1, 0.25, 0.5, 0.75, 0.9 |
|
| 150 |
+
|
| 151 |
+
### 𧬠Lineage
|
| 152 |
+
|
| 153 |
+
`t0` builds on ideas β and in places, code β from open-source forecasting
|
| 154 |
+
models. We gratefully acknowledge:
|
| 155 |
+
|
| 156 |
+
- **Toto** by Datadog ([repo](https://github.com/DataDog/toto)) &
|
| 157 |
+
**Chronos-2** by Amazon
|
| 158 |
+
([repo](https://github.com/amazon-science/chronos-forecasting)) β
|
| 159 |
+
factorizing attention in the time and variates dimension.
|
| 160 |
+
- **TiRex** by NXAI
|
| 161 |
+
([repo](https://github.com/NX-AI/tirex)) β contiguous patch masking.
|
| 162 |
+
|
| 163 |
+
Code-level attributions are listed in [`NOTICE`](NOTICE), all under
|
| 164 |
+
Apache-2.0.
|
| 165 |
+
|
| 166 |
+
## π§° Public API
|
| 167 |
+
|
| 168 |
+
- `T0Forecaster` β `nn.Module` with `from_pretrained` /
|
| 169 |
+
`save_pretrained` (via `huggingface_hub.PyTorchModelHubMixin`) and the
|
| 170 |
+
user-facing `predict(context, horizon, quantiles, future_covariates)`.
|
| 171 |
+
- `T0Config` β frozen dataclass; `T0Config.medium()` is the published
|
| 172 |
+
configuration.
|
| 173 |
+
|
| 174 |
+
## π Citation
|
| 175 |
+
|
| 176 |
+
```bibtex
|
| 177 |
+
@misc{tfc-t0,
|
| 178 |
+
title = {t0: A time-series forecasting foundation model},
|
| 179 |
+
author = {The Forecasting Company},
|
| 180 |
+
year = {2026},
|
| 181 |
+
url = {https://huggingface.co/theforecastingcompany/t0-alpha},
|
| 182 |
+
}
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
## βοΈ License
|
| 186 |
+
|
| 187 |
+
Apache-2.0 β see [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
| 188 |
+
</content>
|
| 189 |
+
</invoke>
|
assets/enedis_with_holidays.png
ADDED
|
Git LFS Details
|
assets/medicam_with_cov.png
ADDED
|
Git LFS Details
|
assets/medicam_without_cov.png
ADDED
|
Git LFS Details
|
config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"embed_dim": 512,
|
| 3 |
+
"num_layers": 24,
|
| 4 |
+
"num_heads": 8,
|
| 5 |
+
"mlp_hidden_dim": 2048,
|
| 6 |
+
"patch_size": 32,
|
| 7 |
+
"group_every_n": 3,
|
| 8 |
+
"dropout": 0.1,
|
| 9 |
+
"quantile_levels": [
|
| 10 |
+
0.1,
|
| 11 |
+
0.25,
|
| 12 |
+
0.5,
|
| 13 |
+
0.75,
|
| 14 |
+
0.9
|
| 15 |
+
],
|
| 16 |
+
"scaler_use_arcsinh": true
|
| 17 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f795594503b90a9fa1565c9e3c0c3523d16b971f283fc4c815a88b1ae2459aa7
|
| 3 |
+
size 406601492
|