An error (error message) occurred during the usage of PatchTSTEstimator. #3172
Unanswered
WeiBrian1994
asked this question in
Q&A
Replies: 1 comment
-
Hi, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
`import pandas as pd
import matplotlib.pyplot as plt
from gluonts.dataset.pandas import PandasDataset
from gluonts.dataset.split import split
from gluonts.torch.model.patch_tst import PatchTSTEstimator
Load data from a CSV file into a PandasDataset
df = pd.read_csv(
"data/ETTh1.csv",
index_col=0,
parse_dates=True,
)
dataset = PandasDataset(df, target="OT")
Split the data for training and testing
training_data, test_gen = split(dataset, offset=-36)
test_data = test_gen.generate_instances(prediction_length=12, windows=3)
Train the model and make predictions
model = PatchTSTEstimator(
prediction_length=12, patch_len = 96, trainer_kwargs={"max_epochs": 5}
).train(training_data)’
When running this code, it encounters a RuntimeError stating that mat1 and mat2 must have the same dtype, but got Double and Float. Although your dataset is indeed float64, you expect that PandasDataset would convert it to float32 automatically. However, the error indicates that there's a mismatch in the data types somewhere in the computation process.
Beta Was this translation helpful? Give feedback.
All reactions