Skip to content

fix csv logger bug #21332

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

Merged
merged 4 commits into from
May 29, 2025
Merged

Conversation

divyashreepathihalli
Copy link
Collaborator

fixes the issue about CSVLogger is setting val_* metrics to nan despite no validation data being provided: #21173

Colab to verify : https://colab.sandbox.google.com/drive/1tZmeU2x_DpB6q5hBtsg2pGTR4KhqK2_7#scrollTo=RtemKVh36rI6

The values to be matched between progbar and cvs logger is fixed in #21331

@codecov-commenter
Copy link

codecov-commenter commented May 28, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.65%. Comparing base (4cb5e38) to head (3ec5c97).

Files with missing lines Patch % Lines
keras/src/callbacks/csv_logger.py 66.66% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21332      +/-   ##
==========================================
- Coverage   82.65%   82.65%   -0.01%     
==========================================
  Files         565      565              
  Lines       54815    54821       +6     
  Branches     8511     8513       +2     
==========================================
+ Hits        45310    45313       +3     
- Misses       7413     7414       +1     
- Partials     2092     2094       +2     
Flag Coverage Δ
keras 82.46% <66.66%> (-0.01%) ⬇️
keras-jax 63.58% <66.66%> (-0.01%) ⬇️
keras-numpy 58.75% <0.00%> (-0.01%) ⬇️
keras-openvino 33.13% <0.00%> (-0.01%) ⬇️
keras-tensorflow 64.00% <66.66%> (-0.01%) ⬇️
keras-torch 63.65% <66.66%> (-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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

self.keys.extend(["val_" + k for k in self.keys])

# Check if the model is expected to produce validation metrics.
if hasattr(self.model, "metrics_names"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: you don't need if hasattr(self.model, "metrics_names"):, it's a property on the Model class:

https://github.com/keras-team/keras/blob/master/keras/src/trainers/trainer.py#L271

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels May 29, 2025
@fchollet fchollet merged commit de9cf25 into keras-team:master May 29, 2025
7 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels May 29, 2025
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