ermongroup / CSDI

Codes for "CSDI: Conditional Score-based Diffusion Models for Probabilistic Time Series Imputation"
MIT License
305 stars 87 forks source link

error in forecasting code. #12

Open m-jam20 opened 9 months ago

m-jam20 commented 9 months ago

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.

y-tashi commented 9 months ago

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.

fangger4396 commented 9 months ago

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.

StefanStanisor commented 8 months ago

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

y-tashi commented 8 months ago

Hi all,

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

StefanStanisor commented 8 months ago

@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 commented 8 months ago

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.