Views
No views yet
timesfm-2.0-500m is the second open model checkpoint:timesfm library for model inference.1import timesfm
2
3# For PyTorch
4tfm = timesfm.TimesFm(
5 hparams=timesfm.TimesFmHparams(
6 backend=<backend>,
7 per_core_batch_size=32,
8 horizon_len=128,
9 input_patch_len=32,
10 output_patch_len=128,
11 num_layers=50,
12 model_dims=1280,
13 use_positional_embedding=False,
14 ),
15 checkpoint=timesfm.TimesFmCheckpoint(
16 huggingface_repo_id="google/timesfm-2.0-500m-pytorch"),
17 )1input_patch_len=32,
2output_patch_len=128,
3num_layers=50,
4model_dims=1280,
5use_positional_embedding=False,tfm.forecast() function and the model will handle it. Currently, the model handles a max context length of 2048, which can be increased in later releases. The input time series can have any context length. Padding / truncation will be handled by the inference code if needed.pandas dataframe. Both forecast methods expect (1) the input time series contexts, (2) along with their frequencies. Please look at the documentation of the functions tfm.forecast() and tfm.forecast_on_df() for detailed instructions.1import numpy as np
2forecast_input = [
3 np.sin(np.linspace(0, 20, 100))
4 np.sin(np.linspace(0, 20, 200)),
5 np.sin(np.linspace(0, 20, 400)),
6]
7frequency_input = [0, 1, 2]
8
9point_forecast, experimental_quantile_forecast = tfm.forecast(
10 forecast_input,
11 freq=frequency_input,
12)pandas dataframe, with the frequency set to "M" monthly.1import pandas as pd
2
3# e.g. input_df is
4# unique_id ds y
5# 0 T1 1975-12-31 697458.0
6# 1 T1 1976-01-31 1187650.0
7# 2 T1 1976-02-29 1069690.0
8# 3 T1 1976-03-31 1078430.0
9# 4 T1 1976-04-30 1059910.0
10# ... ... ... ...
11# 8175 T99 1986-01-31 602.0
12# 8176 T99 1986-02-28 684.0
13# 8177 T99 1986-03-31 818.0
14# 8178 T99 1986-04-30 836.0
15# 8179 T99 1986-05-31 878.0
16
17forecast_df = tfm.forecast_on_df(
18 inputs=input_df,
19 freq="M", # monthly
20 value_name="y",
21 num_jobs=-1,
22)| Dataset | Download Source |
|---|---|
| azure_vm_traces | LOTSA Pretrain |
| residential_load_power | LOTSA Pretrain |
| borg_cluster_data | LOTSA Pretrain |
| residential_pv_power | LOTSA Pretrain |
| q_traffic | LOTSA Pretrain |
| london_smart_meters_with_missing | LOTSA Pretrain |
| taxi_30min | LOTSA Pretrain |
| solar_power | LOTSA Pretrain |
| wind_power | LOTSA Pretrain |
| kdd2022 | LOTSA Pretrain |
| largest | LOTSA Pretrain |
| era5 | LOTSA Pretrain |
| buildings | LOTSA Pretrain |
| cmip6 | LOTSA Pretrain |
| china_air_quality | LOTSA Pretrain |
| beijing_air_quality | LOTSA Pretrain |
| subseasonal | LOTSA Pretrain |
| kaggle_web_traffic_weekly | LOTSA Pretrain |
| cdc_fluview_who_nrevss | LOTSA Pretrain |
| godaddy | LOTSA Pretrain |