Skip to content

[tmva][sofie] Improve Keras test robustness and diagnostics#21749

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:keras_tests
Mar 31, 2026
Merged

[tmva][sofie] Improve Keras test robustness and diagnostics#21749
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:keras_tests

Conversation

@guitargeek

@guitargeek guitargeek commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

This is a spinoff from my Python dev mode PR:

Who knows, maybe the errors on alma8 with NumPy 2.4.4 go away with this, or at least we get some more informative errors! And even if not, this is a good improvement that allows us to run the test with python -W error, which is what I plan generally to do in the CI.

What is already clear from the NumPy warnings is that somehow TensorFlow/Keras doesn't implement the __array__ interface correctly as NumPy 2 expects.

@github-actions

github-actions Bot commented Mar 30, 2026

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 8h 9m 11s ⏱️
 3 834 tests  3 823 ✅   1 💤 10 ❌
72 871 runs  72 722 ✅ 139 💤 10 ❌

For more details on these failures, see this check.

Results for commit 4e6eeb8.

♻️ This comment has been updated with latest results.

  * Skip training for models without trainable weights to avoid spurious
    Keras warnings about "no trainable weights"

  * Suppress NumPy 2.0 __array__ DeprecationWarning during model.save()
    (upstream TF/Keras compatibility issue) using a scoped warnings context

  * Fix Keras inference call for single-input models by unwrapping
    singleton input lists (Keras expects a tensor, not [tensor])

  * Remove redundant load_weights() after load_model()

  * Replace custom is_accurate() with np.testing.assert_allclose()
    for clearer diagnostics and standardized comparison
    * use atol=1e-2 and rtol=0 to preserve previous absolute tolerance behavior

  * Update LeakyReLU argument (alpha -> negative_slope) to avoid
    deprecation warnings

These changes make the tests more robust, reduce noise from external
dependencies, and significantly improve failure diagnostics.

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!
Thanks Jonas for the test improvements!

@guitargeek guitargeek merged commit 1fbee0a into root-project:master Mar 31, 2026
46 of 53 checks passed
@guitargeek guitargeek deleted the keras_tests branch March 31, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants