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
Accuracy is lost after save/load #42459
Comments
I have tried in colab with TF version 2.3, nightly version( |
@ThatDockerUser This is a known issue. Team is working on correcting it. Please check the response from @k-w-w
With the above change (workaround), the results are same before saving and after loading the model back. Please check the gist here. We will follow the progress with that previous issue. Thanks! |
@jvishnuvardhan Thanks for the reply. The SC-accuracy does appear to work. I'm curious, though: How is it different from "regular" accuracy? |
@ThatDockerUser Based on loss function you defined in the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
This issue has been fixed in commit 9d8947. Please try the latest tf-nightly if you need the fix immediately, otherwise the next official TF release will have the fix. Marking this as closed. |
As on 20th Oct 2020. |
@akbaramed As mentioned above, the bug was corrected and we can no longer face the issue when you use In the near future, stable If this is still an issue with |
tensorflow/tensorflow#42459: In tf 2.3, accuracy is buggy.
System information
Describe the current behavior
When saving a pre-trained model and loading it again, the accuracy drops to its default value. Minimal example:
The model is extremely simple (read: bad/useless) for comparison's sake. Before training it, the evaluation results in:
The loss is obviously random at first, but crucially the accuracy is 50% because it guesses 0 every time. After training, it evaluates to:
The loss dropped to zero and the model can perfectly interpret the data. Now I save the model to the disk and immediately load it from the same location. When I now evaluate it, I get:
Even though the model has the same structure, weights, and loss, and all four example inputs are evaluated correctly, TensorFlow says the accuracy is 50%, which is not true.
Describe the expected behavior
The accuracy should remain the same when loading a previously trained and saved model.
Standalone code to reproduce the issue
See above.
Other info / logs
See above.
The text was updated successfully, but these errors were encountered: