timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.07k stars 633 forks source link

arch "PatchTST" can not USE for `TSRegressor` #682

Closed leiyue closed 1 year ago

leiyue commented 1 year ago

I use tsai for test etth1.csv regression task.

arch = "PatchTST"
arch_config = dict(
    n_layers=3,
    n_heads=4,
    d_model=16,
    d_ff=128,
    attn_dropout=0.0,
    dropout=0.3, 
    patch_len=16,
    stride=8, 
    padding_patch=True, 
)
learn = TSRegressor(
        X,
        y,
        splits=train_splits,
        bs=bs,
        arch=arch,
        arch_config=arch_config,
        batch_tfms=batch_tfms,
        pipelines=pipelines,
        drop_last=False,
        metrics=metrics,
        verbose=True,
 )

error:

RuntimeError: The size of tensor a (294912) must match the size of tensor b (512) at non-singleton dimension 0

It's a multivariate predict univariate work that supported by origin PatchTST.

yuqinie98 use features flag tell model that is a "M", "S", or "MS" task. (M:multivariate predict multivariate, S:univariate predict univariate, MS:multivariate predict univariate)

Drive into yuqinie98's code, it use f_dim to slice outputs.

So, let us get this feature that use "PatchTST" for TSRegressor.

oguiza commented 1 year ago

Hi @leiyue, PatchTST is only available for time series forecasting for now. But we'll update its head so that it can be used with regression, classification, and self-supervised learning as soon as we can.

leiyue commented 1 year ago

hi @oguiza, Thank you for your advice, i will close it.