Jae Cha
Jae Cha

Reputation: 31

How do I fix Pytorch-Forecasting model fit ValueError about sequence element

I am new with Pytorch_Forecasting. I followed exactly same as described in 'Demand forecasting with the Temporal Fusion Transformer' (https://pytorch-forecasting.readthedocs.io/en/latest/tutorials/stallion.html). Everything went find until the last model fitting step (trainer.fit(...)). I keep getting the error, "ValueError: dictionary update sequence element #0 has length 1; 2 is required". I cannot figure out where this is happening... I will appreciate any help, any clue, anything to fix my problem

Thanks!!

Upvotes: 3

Views: 1193

Answers (2)

Bitswazsky
Bitswazsky

Reputation: 4698

I think I've found the solution, thanks to this github thread. What you need are the two specific versions of the following libs:

pip install pandas==1.2.5
pip install torchmetrics==0.5.0

I tried installing pandas==1.2.5 in python 3.6 but couldn't do it. It was stuck at pandas==1.1.5. So, I had to use python 3.8. The complete set of relevant packages are:

pytorch-forecasting==0.9.0
pytorch-lightning==1.4.8
torch==1.9.1
torchmetrics==0.5.0
pandas==1.2.5

Upvotes: 0

Parul Bansal
Parul Bansal

Reputation: 11

I faced the same issue. Pytorch_lightning, recently launched a new version, and pytorch-forecasting is built on top of it. I changed the version of torchmetrics to 0.5.0. pip install torchmetrics==0.5.0

Upvotes: 1

Related Questions