Skip to content

[BUG] Error when training Tide with more than 1 unknown reals #1842

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

Open
mrgreen3325 opened this issue May 21, 2025 · 0 comments
Open

[BUG] Error when training Tide with more than 1 unknown reals #1842

mrgreen3325 opened this issue May 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@mrgreen3325
Copy link

mrgreen3325 commented May 21, 2025

Describe the bug

[561](https://vscode-remote+ssh-002dremote-002b192-002e168-002e8-002e123.vscode-resource.vscode-cdn.net/opt/conda/envs/py39_pytorch222/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py:561) call._call_and_handle_interrupt(
[562](https://vscode-remote+ssh-002dremote-002b192-002e168-002e8-002e123.vscode-resource.vscode-cdn.net/opt/conda/envs/py39_pytorch222/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py:562)     self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
[563](https://vscode-remote+ssh-002dremote-002b192-002e168-002e8-002e123.vscode-resource.vscode-cdn.net/opt/conda/envs/py39_pytorch222/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py:563) )

File /opt/conda/envs/py39_pytorch222/lib/python3.9/site-packages/lightning/pytorch/trainer/call.py:48, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
46 if trainer.strategy.launcher is not None:
47 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 48 return trainer_fn(*args, **kwargs)
50 except _TunerExitException:
51 _call_teardown_hook(trainer)
...
267 x_dynamic_future_covariates = self.future_cov_projection(
268 x_dynamic_future_covariates
269 )

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 4 but got size 2 for tensor number 1 in the list.
-->

To Reproduce

tsdataset = TimeSeriesDataSet(
    training_data,
    time_idx="time_idx",
    target="y",  # Single target variable
    group_ids=["group"],
    min_encoder_length=max_encoder_length,
    max_encoder_length=max_encoder_length,
    min_prediction_length=max_prediction_length,
    max_prediction_length=max_prediction_length,
    static_categoricals=[],
    static_reals=[],
    time_varying_known_reals=["time_idx"]+["day"],
    time_varying_unknown_reals= ["y","temperature","humidity"],  # Include both inputs and target
    add_relative_time_idx=False,
    add_target_scales=False,
)

model = TiDEModel.from_dataset(
    tsdataset,
    num_encoder_layers = 32,
    num_decoder_layers = 32,
    learning_rate=0.001,
    hidden_size=32,
    dropout=0.1,
    # loss=SMAPE(),
    loss=RMSE(),
    optimizer="adam"
)
batch_size = 32
train_dataloader = tsdataset.to_dataloader(train=True, batch_size=batch_size, num_workers=8)

Expected behavior

Additional context

Versions
pytorch_forecasting=1.3.0
lightning = 2.5.1
pytorch=2.4.0
python=3.9

@mrgreen3325 mrgreen3325 added the bug Something isn't working label May 21, 2025
@github-project-automation github-project-automation bot moved this to Needs triage & validation in Bugfixing - pytorch-forecasting May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage & validation
Development

No branches or pull requests

1 participant