Add sample usage section
#3
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
- time-series-forecasting
|
| 4 |
- foundation-models
|
|
@@ -10,28 +13,25 @@ tags:
|
|
| 10 |
- gift-eval
|
| 11 |
- safetensors
|
| 12 |
- pytorch_model_hub_mixin
|
| 13 |
-
license: apache-2.0
|
| 14 |
-
pipeline_tag: time-series-forecasting
|
| 15 |
thumbnail: https://corp.dd-static.net/img/about/presskit/kit/press_kit.png
|
| 16 |
-
base_model: Datadog/Toto-2.0-2.5B
|
| 17 |
model-index:
|
| 18 |
- name: Toto-2.0-2.5B-FT
|
| 19 |
results:
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
---
|
| 36 |
|
| 37 |
# Toto-2.0-2.5B-FT
|
|
@@ -51,6 +51,38 @@ A single Toto 2.0 2.5B base checkpoint finetuned on a mix that **includes the GI
|
|
| 51 |
<figcaption>On the full GIFT-Eval leaderboard (foundation models + finetuned + ensemble + agentic), Toto-2.0-2.5B-FT places <b>#2 on CRPS rank, MASE rank, and #3 on raw CRPS / MASE</b>, behind only the <a href="https://huggingface.co/Datadog/Toto-2.0-Family-and-Friends">Toto 2.0 Family-and-Friends</a> ensemble.</figcaption>
|
| 52 |
</figure>
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## 🔁 Finetuning recipe
|
| 55 |
|
| 56 |
Starting from a fully-decayed [Toto-2.0-2.5B](https://huggingface.co/Datadog/Toto-2.0-2.5B) base checkpoint, we finetuned for 10,000 steps on a mix designed to expose the model to in-distribution structure without overfitting to GIFT-Eval alone:
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: Datadog/Toto-2.0-2.5B
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
pipeline_tag: time-series-forecasting
|
| 5 |
tags:
|
| 6 |
- time-series-forecasting
|
| 7 |
- foundation-models
|
|
|
|
| 13 |
- gift-eval
|
| 14 |
- safetensors
|
| 15 |
- pytorch_model_hub_mixin
|
|
|
|
|
|
|
| 16 |
thumbnail: https://corp.dd-static.net/img/about/presskit/kit/press_kit.png
|
|
|
|
| 17 |
model-index:
|
| 18 |
- name: Toto-2.0-2.5B-FT
|
| 19 |
results:
|
| 20 |
+
- task:
|
| 21 |
+
type: time-series-forecasting
|
| 22 |
+
dataset:
|
| 23 |
+
name: GIFT-Eval
|
| 24 |
+
type: GIFT-Eval
|
| 25 |
+
metrics:
|
| 26 |
+
- type: CRPS
|
| 27 |
+
value: 0.463
|
| 28 |
+
name: CRPS
|
| 29 |
+
- type: MASE
|
| 30 |
+
value: 0.679
|
| 31 |
+
name: MASE
|
| 32 |
+
source:
|
| 33 |
+
url: https://huggingface.co/spaces/Salesforce/GIFT-Eval
|
| 34 |
+
name: GIFT-Eval Time Series Forecasting Leaderboard
|
| 35 |
---
|
| 36 |
|
| 37 |
# Toto-2.0-2.5B-FT
|
|
|
|
| 51 |
<figcaption>On the full GIFT-Eval leaderboard (foundation models + finetuned + ensemble + agentic), Toto-2.0-2.5B-FT places <b>#2 on CRPS rank, MASE rank, and #3 on raw CRPS / MASE</b>, behind only the <a href="https://huggingface.co/Datadog/Toto-2.0-Family-and-Friends">Toto 2.0 Family-and-Friends</a> ensemble.</figcaption>
|
| 52 |
</figure>
|
| 53 |
|
| 54 |
+
## 💻 Sample usage
|
| 55 |
+
|
| 56 |
+
First, install the library:
|
| 57 |
+
```bash
|
| 58 |
+
pip install "toto-2 @ git+https://github.com/DataDog/toto.git#subdirectory=toto2"
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Then you can use the model for forecasting as follows:
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
import torch
|
| 65 |
+
from toto2 import Toto2Model
|
| 66 |
+
|
| 67 |
+
model = Toto2Model.from_pretrained("Datadog/Toto-2.0-2.5B-FT")
|
| 68 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 69 |
+
model = model.to(device).eval()
|
| 70 |
+
|
| 71 |
+
# (batch, n_variates, time_steps)
|
| 72 |
+
target = torch.randn(1, 1, 512, device=device)
|
| 73 |
+
target_mask = torch.ones_like(target, dtype=torch.bool)
|
| 74 |
+
series_ids = torch.zeros(1, 1, dtype=torch.long, device=device)
|
| 75 |
+
|
| 76 |
+
# Returns quantiles of shape (9, batch, n_variates, horizon)
|
| 77 |
+
# Quantile levels: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
|
| 78 |
+
quantiles = model.forecast(
|
| 79 |
+
{"target": target, "target_mask": target_mask, "series_ids": series_ids},
|
| 80 |
+
horizon=96,
|
| 81 |
+
decode_block_size=768,
|
| 82 |
+
has_missing_values=False,
|
| 83 |
+
)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
## 🔁 Finetuning recipe
|
| 87 |
|
| 88 |
Starting from a fully-decayed [Toto-2.0-2.5B](https://huggingface.co/Datadog/Toto-2.0-2.5B) base checkpoint, we finetuned for 10,000 steps on a mix designed to expose the model to in-distribution structure without overfitting to GIFT-Eval alone:
|