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

Fix memory leaks in model.evaluate. #20779

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

hertschuh
Copy link
Collaborator

The history is only used in model.fit, no need to create it for evaluate and predict. The history is attached to the model and therefore lives for as long as the model is around.

The executor used in CallbackList was never shut down, causing it to keep a thread around, which in turn had thread locals that were leaked.

The history is only used in `model.fit`, no need to create it for `evaluate` and `predict`. The history is attached to the model and therefore lives for as long as the model is around.

The executor used in `CallbackList` was never shut down, causing it to keep a thread around, which in turn had thread locals that were leaked.
Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jan 17, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.99%. Comparing base (dca9e61) to head (1cb5b9c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #20779   +/-   ##
=======================================
  Coverage   81.99%   81.99%           
=======================================
  Files         555      555           
  Lines       51817    51820    +3     
  Branches     8016     8017    +1     
=======================================
+ Hits        42486    42489    +3     
  Misses       7379     7379           
  Partials     1952     1952           
Flag Coverage Δ
keras 81.81% <100.00%> (+<0.01%) ⬆️
keras-jax 64.11% <100.00%> (+<0.01%) ⬆️
keras-numpy 58.98% <66.66%> (-0.01%) ⬇️
keras-openvino 29.92% <33.33%> (+<0.01%) ⬆️
keras-tensorflow 64.84% <33.33%> (-0.01%) ⬇️
keras-torch 64.09% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fchollet fchollet merged commit a25881c into keras-team:master Jan 17, 2025
10 of 11 checks passed
@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label Jan 17, 2025
@hertschuh hertschuh deleted the evaluate_leaks branch January 18, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants