-
Notifications
You must be signed in to change notification settings - Fork 50
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
move to predict_on_batch #78
Conversation
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
==========================================
+ Coverage 51.49% 51.61% +0.12%
==========================================
Files 11 11
Lines 1610 1614 +4
==========================================
+ Hits 829 833 +4
Misses 781 781
Continue to review full report at Codecov.
|
@jeromelecoq I am not sure I understand why this fixes the issue. The keras docs say to call the model directly for small inputs, ie |
The issue is I think due to a memory leak. I found that looping with predict and GPUs will try to create huge arrays on the GPU. see here: #77 |
It also seemed like this was the expected use in our case, since I am actually feeding one batch of data as described here : https://stackoverflow.com/questions/44972565/what-is-the-difference-between-the-predict-and-predict-on-batch-methods-of-a-ker |
@jeromelecoq I am still confused as to why Are you able to try using |
Yes batch size is usually set to 5 but in this case it is set by the generator so is user-defined. I am with you on not knowing why predict gives a GPU memory issue given the doc. But I can read from the doc that looping predict 1000 times might not be what they are testing for since predict is designed to break down batches internally. In addition, the array allocation request in the error is completely unexpected given the network architecture.
I can try that, why do you think that would be superior to .predict_on_batch? Can you point me at the doc where this is described? |
Here it says
I am just worried that they don't mention |
Ah I see, I am also confused now why do they have predict_on_batch and call options? |
The goal of this PR is to move to using predict_on_batch for inference since that should be both memory and computation efficient.