Skip to content

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

Python

Pre-download config.json in _from_pretrained and bump version to 2.0.2

Rajat Sen2011cfb9a483
diff --git a/pyproject.toml b/pyproject.toml
index 3077b6e..fec54ac 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "timesfm"
-version = "2.0.1"
+version = "2.0.2"
description = "A time series foundation model."
authors = [
{name = "Rajat Sen", email = "[email protected]"},
diff --git a/src/timesfm/timesfm_2p5/timesfm_2p5_torch.py b/src/timesfm/timesfm_2p5/timesfm_2p5_torch.py
index e41ad5a..90cd07d 100644
--- a/src/timesfm/timesfm_2p5/timesfm_2p5_torch.py
+++ b/src/timesfm/timesfm_2p5/timesfm_2p5_torch.py
@@ -278,6 +278,7 @@ class TimesFM_2p5_200M_torch(
DEFAULT_REPO_ID = "google/timesfm-2.5-200m-pytorch"
WEIGHTS_FILENAME = "model.safetensors"
+ CONFIG_FILENAME = "config.json"
def __init__(
self,
@@ -322,6 +323,19 @@ class TimesFM_2p5_200M_torch(
method provided by `PyTorchModelHubMixin`.
"""
# Determine the path to the model weights.
+ try:
+ hf_hub_download(
+ repo_id=model_id,
+ filename=cls.CONFIG_FILENAME,
+ revision=revision,
+ cache_dir=cache_dir,
+ force_download=force_download,
+ local_files_only=local_files_only,
+ token=token,
+ )
+ except Exception:
+ pass
+
model_file_path = ""
if os.path.isdir(model_id):
logging.info("Loading checkpoint from local directory: %s", model_id)