timesfm 2.0 500m pytorch
googleIntroduction
TimesFM (Time Series Foundation Model) is a pretrained model developed by Google Research for time-series forecasting. It supports univariate time series forecasting with a focus on point forecasts and offers some experimental features like quantile heads.
Architecture
TimesFM can handle context lengths up to 2048 time points and various horizon lengths. It uses a decoder-only architecture, allowing the model to manage univariate time series forecasting by filling in missing values through linear interpolation. It operates optimally with contiguous context and frequency-consistent horizon data.
Training
The TimesFM 2.0 model was pretrained using a subset of datasets from the LOTSA pretraining data, which includes a variety of data sources such as residential power loads, traffic data, and more. The training process aimed to equip the model with robust capabilities to handle various time-series forecasting tasks.
Guide: Running Locally
-
Installation
- Install the
timesfm
library from the GitHub repository: TimesFM GitHub.
- Install the
-
Initialize the Model
import timesfm tfm = timesfm.TimesFm( hparams=timesfm.TimesFmHparams( backend=<backend>, per_core_batch_size=32, horizon_len=128, input_patch_len=32, output_patch_len=128, num_layers=50, model_dims=1280, use_positional_embedding=False, ), checkpoint=timesfm.TimesFmCheckpoint( huggingface_repo_id="google/timesfm-2.0-500m-pytorch"), )
-
Perform Inference
- Utilize the
tfm.forecast()
function for array inputs ortfm.forecast_on_df()
for pandas dataframe inputs. - Ensure the frequency input is consistent with the model’s categorical expectations (e.g., 0 for high frequency).
- Utilize the
-
Compute Requirements
- Given the model's complexity, using a cloud GPU is recommended for efficient performance.
License
The TimesFM model and its associated code are distributed under the Apache-2.0 license.