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

Enhancement: Save Model & Predict #4

Open
silakanveli opened this issue Mar 8, 2018 · 2 comments
Open

Enhancement: Save Model & Predict #4

silakanveli opened this issue Mar 8, 2018 · 2 comments

Comments

@silakanveli
Copy link

What would be the best way to save models and then use saved model to make predictions?

@ahirner
Copy link
Owner

ahirner commented Mar 12, 2018

You'd get model.statedict()and save it with torch.save(...). Ideally, just save the model if it was of greater accuracy than any epoch before. One approach is to wrap the statedict in an outer dictionary that also contains this value.
Load the statedict with torch.load(...) and then into the model with model.load_state_dict(...). Hope that helps. I might bolt that very necessary feature on one day ;)

@silakanveli
Copy link
Author

Sounds good approach. I see this package is already very nice for fine tuning. Would be superb to save models and use those to predict. Nice work!

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

No branches or pull requests

2 participants