Time Series Forecasting
Safetensors
granite_tsfm
tinytimemixer
ttm4hvac
tsfm
digital twin
hvac
energy
File size: 5,980 Bytes
71fbc29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
library_name: granite_tsfm
base_model: ibm-granite/granite-timeseries-ttm-r2
tags:
- ttm4hvac
- tsfm
- digital twin
- hvac
- energy
license: apache-2.0
papers:
- title: "Transfer learning of building dynamics digital twin for HVAC control with Time-series Foundation Model"
  url: https://arxiv.org/abs/XXXX.XXXXX
  authors: "Ferran Aran Domingo"
datasets:
- gft/ttm4hvac-source-all-train
- gft/ttm4hvac-target-heat-test
- gft/ttm4hvac-target-cool-test
pipeline_tag: time-series-forecasting
---

# TTM4HVAC – TinyTimeMixer for HVAC dynamics modeling

This repository contains the **primary and recommended checkpoint** of the **TTM4HVAC** project: a fine-tuned version of IBM's *TinyTimeMixer* designed to serve as a generic digital twin of building dynamics under an HVAC system.

This model corresponds to the **“source-all”** training configuration (all source buildings, full dataset), and it achieves the best overall performance across the TTM4HVAC evaluation benchmarks.

Read more on the paper: [arXiv:XXXX.XXXXX]() (to be released).

---

# 🔧 Installation

The model uses IBM’s Granite Time Series Foundation Model tooling, available from PyPI:

```bash
pip install granite-tsfm==0.3.1
````

This installs the `tsfm_public` package containing:

* `TinyTimeMixerForPrediction`
* `TimeSeriesPreprocessor`
* `TimeSeriesForecastingPipeline`
* dataset utilities

---

# 🚀 Quickstart

This example loads the model directly from Hugging Face and performs:

1. Data preprocessing
2. Zero-shot evaluation
3. Forecast generation

```python
import pandas as pd
import torch

from tsfm_public import (
    TinyTimeMixerForPrediction,
    TimeSeriesPreprocessor,
    TimeSeriesForecastingPipeline,
    get_datasets,
)
from tsfm_public.toolkit.time_series_preprocessor import prepare_data_splits

MODEL_ID = "gft/ttm4hvac"
device = "cuda" if torch.cuda.is_available() else "cpu"

TARGETS = [
    "Room Air Temperature (C)",
    "HVAC Power Consumption (W)"
]
OBSERVABLES = [
    "Outdoor Air Temperature (C)",
    "Outdoor Humidity (%)",
    "Wind Speed (m/s)",
    "Direct Solar Radiation (W/m^2)",
]
CONTROLS = [
    "Heating Setpoint (C)",
    "Cooling Setpoint (C)"
]
ID_COLUMNS = []
TIMESTAMP_COLUMN = "time"

BATCH_SIZE = 32
SPLIT_CONFIG = {"train": 0.35, "test": 0.25}  # val is inferred


def run_inference(df: pd.DataFrame, model_id: str = MODEL_ID):
    # 1) Load the fine-tuned TinyTimeMixer model from Hugging Face
    model = TinyTimeMixerForPrediction.from_pretrained(model_id)
    model.to(device)

    context_length = model.config.context_length
    prediction_length = model.config.prediction_length

    # 2) Build the preprocessor
    tsp = TimeSeriesPreprocessor(
        timestamp_column=TIMESTAMP_COLUMN,
        target_columns=TARGETS,
        control_columns=CONTROLS,
        observable_columns=OBSERVABLES,
        id_columns=ID_COLUMNS,
        context_length=context_length,
        prediction_length=prediction_length,
        scaling=True,
        freq="15min",
        encode_categorical=False,
        scaler_type="standard",
    )

    # 3) Prepare test split
    _, _, df_test = prepare_data_splits(
        df, context_length=context_length, split_config=SPLIT_CONFIG
    )

    # 4) Build the forecasting pipeline
    pipeline = TimeSeriesForecastingPipeline(
        model,
        device=device,
        feature_extractor=tsp,
        batch_size=BATCH_SIZE,
    )

    # 5) Generate forecasts
    df_forecast = pipeline(df_test)

    return df_test, df_forecast

```

## Example using [gft/ttm4hvac-target-heat-test]()

```python
from datasets import load_dataset

ds = load_dataset("gft/ttm4hvac-target-heat-test")
df = ds["test"].to_pandas()
df.head()
```

---

# 📑 Input Schema

Your input `pandas.DataFrame` must contain:

* `time` (timestamp column)
* **Targets:**

  * `Room Air Temperature (C)`
  * `HVAC Power Consumption (W)`
* **Observables:**

  * `Outdoor Air Temperature (C)`
  * `Outdoor Humidity (%)`
  * `Wind Speed (m/s)`
  * `Direct Solar Radiation (W/m^2)`
* **Controls:**

  * `Heating Setpoint (C)`
  * `Cooling Setpoint (C)`

Sampling frequency must be **15 minutes** (`freq="15min"`).

---

# 📦 Related models (TTM4HVAC family)

These models correspond to each experiment documented on the [paper]():

  - `gft/ttm4hvac` - Main model, best performer (this repo)
  - [`gft/ttm4hvac-source-default`](https://huggingface.co/gft/ttm4hvac-source-default)
  - [`gft/ttm4hvac-target-default`](https://huggingface.co/gft/ttm4hvac-target-default)
  - [`gft/ttm4hvac-target-chaotic`](https://huggingface.co/gft/ttm4hvac-target-chaotic)

---

# 📚 Related Datasets

Training and evaluation datasets used for this fine-tune:

* [`gft/ttm4hvac-source-all-train`](https://huggingface.co/datasets/gft/ttm4hvac-source-all-train)
* [`gft/ttm4hvac-target-heat-test`](https://huggingface.co/datasets/gft/ttm4hvac-target-heat-test)
* [`gft/ttm4hvac-target-cool-test`](https://huggingface.co/datasets/gft/ttm4hvac-target-cool-test)

Other datasets:

* [`gft/ttm4hvac-source-default-train`](https://huggingface.co/datasets/gft/ttm4hvac-source-default-train)
* [`gft/ttm4hvac-target-chaotic-train`](https://huggingface.co/datasets/gft/ttm4hvac-target-chaotic-train)
* [`gft/ttm4hvac-target-default-train`](https://huggingface.co/datasets/gft/ttm4hvac-target-default-train)

---

# 📘 Project Overview

**TTM4HVAC** investigates how foundation-model-based time-series architectures (*TinyTimeMixer*, from IBM Granite TSFM) can:

* model complex building thermal dynamics,
* generalize across buildings and climates,
* support transfer from source → target buildings,
* evaluate under diverse behavioral patterns (default schedules vs chaotic occupants).

---

# ✒️ Citation

If you use this model or datasets, please cite:

```
**F. Aran**,  
*Transfer learning of building dynamics digital twin for HVAC control with Time-series Foundation Model*,  
arXiv:XXXX.XXXXX, 2025.  
https://arxiv.org/abs/XXXX.XXXXX
```