AI4HealthUOL / SSSD-ECG

Repository for the paper: 'Diffusion-based Conditional ECG Generation with Structured State Space Models'
MIT License
36 stars 4 forks source link

Can't load trained model #14

Closed gabrielvc closed 4 months ago

gabrielvc commented 4 months ago

Hello.

I am currently having trouble running the experiments. The inference.py script does not run with models from train.py. It seems it's a problem with the batch size being used in training and the variables z and omega that are created in one of the S4 inner layers. I can't make it work by creating a new net, then using a dummy input of the same batch size and then loading the model. Is this normal?

juanlopezcode commented 4 months ago

Hi again, Without the traceback, I can't see exactly what is going on to provide some support. But it seems that your problems are coming from the way your model has been saved. During training, in the config file, you should adjust the s4_lmax hyperparameter as the length of the time series (I left that by default value for PTB-XL, so you shouldn't change it for it, but if is for another dataset, you might change it depend on the length), otherwise, the s4 model will iteratively learn this parameter during training which won't let you load the model later for inference. Hope this helps Best Juan

gabrielvc commented 4 months ago

Hi,

Thank you for you answer. This explains why I needed the batch size.

Best, Gabriel