CSDI icon indicating copy to clipboard operation
CSDI copied to clipboard

error in forecasting code.

Open m-jam20 opened this issue 1 year ago • 6 comments

Hi, when I run exe_forecasting.py it gives me type error.

The type error is : TypeError: embedding(): argument 'indices' (position 2) must be Tensor, not NoneType

It is from this part of the code: main_model.py", line 356, in get_side_info feature_embed = self.embed_layer(feature_id).unsqueeze(1).expand(-1,L,-1,-1)

It would be great if you fix this.

m-jam20 avatar Feb 16 '24 00:02 m-jam20

Hi,

I have run the code with the sample electricity dataset and there is no problem. If you use your original dataset, please set "target_dim" in exe_forecasting.py.

y-tashi avatar Feb 19 '24 01:02 y-tashi

Hi,

I have the same error as follows:

TypeError: embedding(): argument 'indices' (position 2) must be Tensor, not NoneType

I use the electricity dataset here. It seems that the feature_id here is None and the embed_layer can not accept a None as input. I am not sure if it matches the original intent of the authors.

fangger4396 avatar Feb 28 '24 10:02 fangger4396

I am having the same problem, using the electricity dataset provided

StefanStanisor avatar Mar 13 '24 08:03 StefanStanisor

Hi all,

Sorry for the inconvenience. I have understood the issue and fixed the code.

y-tashi avatar Mar 14 '24 15:03 y-tashi

@y-tashi I can confirm that it is working now.

However, I am getting weird results when predicting. I get inf and all the computed losses are nan. I looked a bit in the results and they seem to blow up more and more from sample to sample.

I am running the model on 'mps' device, which is the GPU provided by apple on their Macbook Ms and I am suspecting that is where the error is coming from.

If anyone has encounterd this problem and identified any possible solutions, that would be a life saver as I am trying to write my Masters thesis and I don't have a Nvidia GPU.

I am also obtaining this type of results when predicting using TimeGrad model as well.

StefanStanisor avatar Mar 15 '24 08:03 StefanStanisor

OK, so I ran it on cpu and indeed I stop getting inf and nan values. Any idea what (maybe a particular pytorch module like LayerNorm or smth) is causing mps to blow up? I am thinking I could rewrite the module and maybe than it will work.

StefanStanisor avatar Mar 15 '24 12:03 StefanStanisor