Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: expected np.ndarray (got numpy.ndarray) when using forecast function #166

Open
Charmery opened this issue Oct 24, 2024 · 0 comments

Comments

@Charmery
Copy link

Hello,
I encountered a TypeError while using the timesFM model. The details are as follows:
Environment:

  • Python version: 3.10
  • checkpoint: timesfm-1.0-200m-pytorch
    Issue Description:
    I received the following error when attempting to use the forecast function for prediction:
TypeError: expected np.ndarray (got numpy.ndarray)

Error Traceback:

TypeError                                 Traceback (most recent call last)
Cell In[5], line 9
...
--> 9 point_forecast, experimental_quantile_forecast = tfm.forecast(
     10     forecast_input,
     11     freq=frequency_input,
     12 )
File ~/.conda/envs/czy-timesfm/lib/python3.10/site-packages/timesfm/timesfm_torch.py:130, in TimesFmTorch.forecast(self, inputs, freq, window_size, forecast_context_len, return_forecast_on_context, truncate_negative)
...
TypeError: expected np.ndarray (got numpy.ndarray)

Code Example:

forecast_input = [
    np.sin(np.linspace(0, 20, 100)),
    np.sin(np.linspace(0, 20, 200)),
    np.sin(np.linspace(0, 20, 400)),
]
frequency_input = [0, 1, 2]
point_forecast, experimental_quantile_forecast = tfm.forecast(
    forecast_input,
    freq=frequency_input,
)

I confirmed that forecast_input is a list containing multiple numpy.ndarray objects, but it seems there is a type error when processing within the forecast function. Is this an issue with my usage or a bug in timesFM? How can I resolve this issue?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant