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 save and evaluate model after training ? #4
Comments
You would need to show me exactly what you do. Ideally, you do:
Also, you might not want to use the weights directly AFTER training, but those that provide the best validation performance (as is done automatically when calling |
Thanks @Confusezius ; will test with your inputs. I was saving the model.state_dict after every epoch and picked the model file with best validation performance. |
@dnaveenr keep me posted, both if everything works out or not :) |
@Confusezius Sure. Will keep you posted. |
So for methods like ProxyNCA where you use external proxies to create meaningful n-tuples for training it doesn't matter (to a certain degree). However, for triplet sampling methods like semihard or distance sampling, there is a notable drop in performance for small batchsizes, as the set of triplets you can create per choice of anchor gets smaller, thereby constraining the effectiveness of your sampling method. In that regard, I have seen significant performance change for batchsizes below 100. However you can try and counter it a bit by maybe making |
Thanks. Very insightful. I will try tweaking --n_samples_per_class and check. |
Feel free to reopen this issue if there are any other issues :). Otherwise I'll close it for now. |
I wanted to know how we could save the model weights and use it for inference on some test data ?
I tried using torch.save() and torch.load() after all completion of all epochs, but the results are not similar as to automatic eval on test split and quite bad.
Could you please provide some inputs on this ?
The text was updated successfully, but these errors were encountered: