-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to load model from local directory #193
Comments
Thank you for the suggestions. |
Hi maryamag85 and mufeili, great question and great package. I am also trapped by this problem that I cannot find a function to load the model from the saved model.pth in local. Would you mind introducing related documents or codes so that we can write our codes to load the pre-trained model from the local path? I have tried to search in this repository, however, I do not yet find a clear solution to this problem. For instance, on this page, 'https://github.com/awslabs/dgl-lifesci/blob/d781b80793dc84de5c0c4ac674091299c9b95cb0/examples/property_prediction/pubchem_aromaticity/utils.py', the AttentiveFP is loaded by initializing a new model with known parameters, rather than a pre-trained model. Thank you very much! |
Hi @REMUU , thank you for raising the issue. Is there a particular pre-trained model that you are looking for? |
Hi @mufeili, thank you for your reply. I used the AttentiveFP to train my own model and save it as 'model.pth' in my local path. My problem is I cannot find a function to load this model. So I try to write the following code to load the model, however, this error has been raised. My code is modified from 'https://github.com/awslabs/dgl-lifesci/blob/2fbf5fd6aca92675b709b6f1c3bc3c6ad5434e96/python/dgllife/model/pretrain/__init__.py' between line 51 to 55.
Version Information: I am not sure why this error happens, could you have a look at it? Thank you very much. |
You still need to initialize a model object which has the same architecture as the AttentiveFP model you trained like |
Thank you very much! The model can be loaded. |
I can find the download_and_load_checkpoint class which is downloading the pretrianed model directly from the source page but I can not find a function that gets a local path and load the pretrianed saved model. I have solved this situation in my code but I think it would be helpful to have an integrated class for doing this instead.
The text was updated successfully, but these errors were encountered: