liuxu77 / UniTime

UniTime: A Language-Empowered Unified Model for Cross-Domain Time Series Forecasting (WWW 2024)
Apache License 2.0
63 stars 5 forks source link

how resize seq_len? #5

Closed m6129 closed 2 months ago

m6129 commented 3 months ago

Hello, Dear Developer. I tried changing the seq_len to 720, 336, but I've encountered errors

Traceback (most recent call last):
  File "/kaggle/working/UniTime_for_Kaggle/run_univariate.py", line 67, in <module>
    engine.train()
  File "/kaggle/working/UniTime_for_Kaggle/engines/engine_univariate.py", line 133, in train
    loss = self.train_engines[idx].train_batch(batch, self.model, self.optimizer)
  File "/kaggle/working/UniTime_for_Kaggle/engines/engine_forecasting.py", line 45, in train_batch
    loss = self.criterion(outputs, batch_y)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py", line 535, in forward
    return F.mse_loss(input, target, reduction=self.reduction)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/functional.py", line 3328, in mse_loss
    expanded_input, expanded_target = torch.broadcast_tensors(input, target)
  File "/opt/conda/lib/python3.10/site-packages/torch/functional.py", line 73, in broadcast_tensors
    return _VF.broadcast_tensors(tensors)  # type: ignore[attr-defined]
RuntimeError: The size of tensor a (624) must match the size of tensor b (1440) at non-singleton dimension 1
CPU times: user 648 ms, sys: 134 ms, total: 782 ms
Wall time: 37.1 s

How to solve this problem properly, I want to test your model with a different seq_len?

liuxu77 commented 2 months ago

Hi, I think you could print out the shapes of outputs and batch_y, to see if there is any inconsistency.