DC-research / TEMPO

The official code for "TEMPO: Prompt-based Generative Pre-trained Transformer for Time Series Forecasting (ICLR 2024)". TEMPO is one of the very first open source Time Series Foundation Models for forecasting task v1.0 version.
79 stars 12 forks source link

UnboundLocalError: local variable 'seq_trend' referenced before assignment AFTER training for 1 epoch by train_TEMPO.py #10

Open Lanxin1011 opened 2 weeks ago

Lanxin1011 commented 2 weeks ago

Dear Authors: Thanks for you brilliant work! I encountered an error when running the train_TEMPO.py script, could you please take a look on how to solve the problem? Thanks a lot!

Here is the error info: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 1757/1757 [08:11<00:00, 3.5100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 1757/1757 [08:11<00:00, 3.58it/s] Epoch: 1 cost time: 491.01318168640137 0it [00:00, ?it/s] Traceback (most recent call last): File "train_TEMPO.py", line 342, in <module> vali_loss = vali(model, vali_data, vali_loader, criterion, args, device, ii) File "/mnt/workspace/TEMPO/utils/tools.py", line 352, in vali seq_trend = seq_trend.float().to(device) UnboundLocalError: local variable 'seq_trend' referenced before assignment

Lanxin1011 commented 2 weeks ago

I modified line 343 as batch_x, batch_y, batch_x_mark, batch_y_mark, seq_trend, seq_seasonal, seq_resid = data[0], data[1], data[2], data[3], data[4], data[5], data[6] , and the error disappeared. Could you please tell me if the modification I've made is correct?

Best regards

idevede commented 1 week ago

Hi Lanxin1011,

Thank you for your interest in our work and for actively engaging with the experiments. You are correct regarding your suggested changes. I intended to add code adaptability for different dataloaders but inadvertently omitted this code. Let me fix it quickly.

Best