HKUDS / FlashST

[ICML'2024] "FlashST: A Simple and Universal Prompt-Tuning Framework for Traffic Prediction"
https://arxiv.org/abs/2405.17898
Apache License 2.0
59 stars 2 forks source link

dimension dismatch problem #1

Closed Coldmooon closed 4 months ago

Coldmooon commented 5 months ago

I run the provided examples:

  # Evaluate the performance of MTGNN enhanced by FlashST on the PEMS07M dataset
python Run.py -dataset_test PEMS07M -mode eval -model MTGNN

# Pretrain from scratch with MTGNN model, checkpoint will be saved in FlashST-main/SAVE/pretrain/MTGNN(model name)/xxx.pth
python Run.py -mode pretrain -model MTGNN

But both examples encounter errors:

  File "/home/liyang/Developer/FlashST/model/PromptNet.py", line 118, in forward
    hidden = torch.cat([time_series_emb] + node_emb + tem_emb, dim=-1).transpose(1, 3)
RuntimeError: Sizes of tensors must match except in dimension 3. Expected size 228 but got size 57 for tensor number 1 in the list.
  File "/home/liyang/Developer/FlashST/model/PromptNet.py", line 118, in forward
    hidden = torch.cat([time_series_emb] + node_emb + tem_emb, dim=-1).transpose(1, 3)
RuntimeError: Sizes of tensors must match except in dimension 3. Expected size 358 but got size 90 for tensor number 1 in the list.

I have prepared the data according to the README.md

LZH-YS1998 commented 4 months ago

Hello, I reran the code and did not encounter this issue. Could you provide more details about the experiment, or use the following code to check the dimensions of the tensors before concatenation:

print(time_series_emb.shape, node_emb[0].shape, tem_emb[0].shape, tem_emb[1].shape)
Yumi-Zhang0229 commented 2 months ago

print(time_series_emb.shape, node_emb[0].shape, tem_emb[0].shape, tem_emb[1].shape)

Hello, I have the same problem. I find the dimension of node_emb is [7, 1, 23, 32], while the dimension of time_series_emb and tem_emb is [7, 1, 228, 32]. Could you help me? image