Skip to content
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 a pretrained model? #125

Open
czt616 opened this issue Jan 8, 2020 · 3 comments
Open

How to load a pretrained model? #125

czt616 opened this issue Jan 8, 2020 · 3 comments
Labels
question Further information is requested

Comments

@czt616
Copy link

czt616 commented Jan 8, 2020

After using trainer.save() to save the model. How can I load this model and evaluate it? Thanks!

@czt616 czt616 added the question Further information is requested label Jan 8, 2020
@RenShuhuai-Andy
Copy link

trainer = mz.trainers.Trainer(..., checkpoint=\path\to\your\saved\model)

@RenShuhuai-Andy
Copy link

@caiyinqiong @Chriskuei Hi~ I have an anthor question about loading pretrained model. When we Instantiate a trainer, it seems that the parameter trainloader and validloader must be passed in with strict type check. To get these two loaders requires inconvenient time for data preprocessing. However, if we just use trainer to predict or evaluate, there is no need to get trainloader and validloader. This seems to be an unreasonable design. Or do you have any idea to solve this problem? Thanks.

@czt616
Copy link
Author

czt616 commented Feb 21, 2020

@RenShuhuai-Andy I used the code in the tutorial-conv-knrm. And I use trainer.restore_model('./pretrained_cknrm/1/model.pt')
print(trainer.evaluate(testloader))
But why I get different result every time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants