I would like to predict a time series via TimeSeriesTransformerForPrediction described here: Time Series Transformer but I only got past_values and future_values and I get the error:
TypeError: forward () missing 4 required positional arguments: ‘past_time_features’, ‘past_observed_mask’, ‘static_categorical_features’, and ‘static_real_features’
Where am I wrong?
This is the code :
import torch import torch.nn as nn x_train = torch.from_numpy(x_train).type(torch.Tensor) x_test = torch.from_numpy(x_test).type(torch.Tensor) y_train = torch.from_numpy(y_train).type(torch.Tensor) y_test = torch.from_numpy(y_test).type(torch.Tensor) from transformers import TimeSeriesTransformerForPrediction model = TimeSeriesTransformerForPrediction.from_pretrained( "huggingface/time-series-transformer-tourism-monthly" ) # during training, one provides both past and future values # as well as possible additional features outputs = model( past_values=x_train, #past_time_features=None, #past_observed_mask=None, #static_categorical_features=None, #static_real_features=None, future_values=x_test, #future_time_features=None ) loss = outputs.loss loss.backward()