You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to load a trained model, without initialising the class beforehand manually?
Since save_model saves the whole model and not only model.state_dict(), the model setup is saved I guess - but I don't know how to load it?
The tutorials only show loading the model after it was initalised previously already.
2. Motivation
After initialising SAITS model, the trained weights can be loaded using saits.load_model(dir).
However, to initialise the model correctly, you need to know n_steps, n_features, etc. before loading the model.
3. Your contribution
I tired loading the model using saits = torch.load(directory).
This loads the module _SAITS.
Running imputation then gives the error AttributeError: '_SAITS' object has no attribute 'impute'.
The text was updated successfully, but these errors were encountered:
Please read the doc https://docs.pypots.com/en/latest/pypots.imputation.html#pypots.imputation.saits.SAITS.load_model. Each model in PyPOTS has both functions save_model() and load_model(). After your training, you will find the trained model file saved by PyPOTS. To reload it, you need to initialize a model with the same model hyperparameters, then run model.load_model(path_to_your_saved_model_file).
BTW, if you think SAITS and PyPOTS are useful to your work, please star🌟 them on GitHub and cite them properly in your research 😊 Thank you, Elke! This means a lot to our open-science work.
1. Feature description
How to load a trained model, without initialising the class beforehand manually?
Since
save_model
saves the whole model and not onlymodel.state_dict()
, the model setup is saved I guess - but I don't know how to load it?The tutorials only show loading the model after it was initalised previously already.
2. Motivation
After initialising SAITS model, the trained weights can be loaded using
saits.load_model(dir)
.However, to initialise the model correctly, you need to know n_steps, n_features, etc. before loading the model.
3. Your contribution
I tired loading the model using
saits = torch.load(directory)
.This loads the module
_SAITS
.Running imputation then gives the error
AttributeError: '_SAITS' object has no attribute 'impute'
.The text was updated successfully, but these errors were encountered: