Time Series Forecasting
TimesFM

Loading Error: Cannot find torch_model.ckpt for pfnet/timesfm-1.0-200m-fin using timesfm library

#1
by Walorne - opened

Hi PFNET Team,

I'm trying to use your fine-tuned pfnet/timesfm-1.0-200m-fin model for time series forecasting using the official timesfm library (from the google-research GitHub repository).

I'm running into an issue during model initialization with the PyTorch backend. When the library attempts to load the checkpoint using timesfm.TimesFm and timesfm.TimesFmCheckpoint, it fails with the following error:

OSError: [Errno 2] No such file or directory: 'C:\Users\user\.cache\huggingface\hub\models--pfnet--timesfm-1.0-200m-fin\snapshots\\torch_model.ckpt'

Looking at the files in the pfnet/timesfm-1.0-200m-fin repository on Hugging Face Hub, I can see pytorch_model.bin and model.safetensors, but not the expected torch_model.ckpt file that the timesfm library seems to be looking for by default.

My initialization code looks like this (based on the timesfm library examples):

import timesfm
import os

Disable symlinks on Windows (to avoid potential permission errors)

os.environ['HF_HUB_DISABLE_SYMLINKS'] = '1'

Model configuration (example)

model_name = "pfnet/timesfm-1.0-200m-fin"
backend = "gpu" # or "cpu"
model_horizon = 128
context_window = 512

try:
tfm = timesfm.TimesFm(
hparams=timesfm.TimesFmHparams(
backend=backend,
per_core_batch_size=32,
horizon_len=model_horizon,
context_len=context_window,
# Removed num_layers/use_positional_embedding as they might not apply to v1.0 checkpoint loading this way
),
checkpoint=timesfm.TimesFmCheckpoint(
huggingface_repo_id=model_name
)
)
print("Model initialized successfully?") # This line is not reached
except Exception as e:
print(f"Error initializing model {model_name}: {e}")

Could you please provide guidance on the correct way to load the pfnet/timesfm-1.0-200m-fin checkpoint using the timesfm library's PyTorch backend? Does it require specific parameters in TimesFmHparams, or is there a different loading mechanism needed due to the model file names (pytorch_model.bin/model.safetensors)?

Any help or example code would be greatly appreciated!

Thanks,
[Walorne]

Key points in the message:

  • Clearly states the model name (pfnet/timesfm-1.0-200m-fin).
  • Specifies the library being used (timesfm from google-research).
  • Includes the exact error message (OSError: [Errno 2] No such file or directory: ...torch_model.ckpt).
  • Explains the observation that torch_model.ckpt is missing, but pytorch_model.bin / model.safetensors are present.
  • Provides the initialization code snippet.
  • Directly asks for the correct loading procedure for this specific fine-tuned model.

Sign up or log in to comment