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

PatchTST output/target tensor mismatch in loss function #803

Open
E-Penguin opened this issue Jul 4, 2023 · 2 comments
Open

PatchTST output/target tensor mismatch in loss function #803

E-Penguin opened this issue Jul 4, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@E-Penguin
Copy link

E-Penguin commented Jul 4, 2023

edit
Having read the other issues, this might be related to #738 & #713 as it's trying a multivariate input/univariate output. I'm happy to make some code changes if you point me in the right direction
/edit

Runtime Error when using PatchTST (it works with, for example TSTPlus):

    return _VF.broadcast_tensors(tensors)  # type: ignore[attr-defined]
RuntimeError: The size of tensor a (241920) must match the size of tensor b (70) at non-singleton dimension 0

Code to reproduce:

from tsai.basics import *

X, y, splits = get_regression_data('AppliancesEnergy', split_data=False)
tfms = [None, TSRegression()]
batch_tfms = TSStandardize(by_sample=True)
batch_size = 70
reg = TSRegressor(X, y, splits=splits, path='models', arch="PatchTST", tfms=tfms, batch_tfms=batch_tfms, batch_size=batch_size, metrics=rmse, verbose=True)
reg.fit_one_cycle(100, 3e-4)
reg.export("reg.pkl")

from tsai.inference import load_learner

reg = load_learner("models/reg.pkl")
raw_preds, target, preds = reg.get_X_preds(X[splits[1]], y[splits[1]])
print(raw_preds)
@oguiza
Copy link
Contributor

oguiza commented Sep 3, 2023

Hi @E-Penguin, this is not yet currently supported by PatchTST. For now, you can only use it with univariate datasets, or multivariate datasets where you predict all input variables (in fact, this is a duplicate of #713).

@oguiza oguiza added duplicate This issue or pull request already exists enhancement New feature or request labels Sep 3, 2023
@MALIK2k21
Copy link

Hi @oguiza I just wanted to confirm if this issue is still unresolved(multivariate input ---> univariate output)?. I have traied but got mismatch error so I just wanted to know if you had a solution for this now?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants