Skip to content

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

Python

Merge pull request #8 from kashif/hub

Yichen Zhou2fafb794fa40
diff --cc src/timesfm.py
index e10ebc3,2887aad..8850239
--- a/src/timesfm.py
+++ b/src/timesfm.py
@@@ -229,10 -232,15 +232,15 @@@ class TimesFm
"""Loads a checkpoint and compiles the decoder.
Args:
- checkpoint_path: path to the checkpoint directory.
+ checkpoint_path: Optional path to the checkpoint directory.
+ repo_id: Hugging Face Hub repo id.
checkpoint_type: type of PAX checkpoint
- step: step of the checkpoint to load. If `None`, load lastest checkpoint.
+ step: step of the checkpoint to load. If `None`, load latest checkpoint.
"""
+ # Download the checkpoint from Hugging Face Hub if not given
+ if checkpoint_path is None:
+ checkpoint_path = path.join(snapshot_download(repo_id), "checkpoints")
+
# Initialize the model weights.
self._logging("Constructing model weights.")
start_time = time.time()