NatLibFi / Annif

Annif is a multi-algorithm automated subject indexing tool for libraries, archives and museums.
https://annif.org
Other
190 stars 41 forks source link

Switch to Keras v3 save format for nn_ensemble #730

Closed osma closed 11 months ago

osma commented 11 months ago

With the TensorFlow 2.13 update in PR #726, these warnings are shown:

UserWarning: You are saving your model as an HDF5 file via `model.save()`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')

This PR addresses the problem by switching to the new Keras v3 (.keras) format for saving the trained nn_ensemble models.

Keras imports are modernized so that they follow current conventions (no need to use tensorflow.keras, and switched to the new keras.saving submodule).

Note that this PR branch includes all the commits from PR #726.

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (40cc2fd) 99.67% compared to head (4886e08) 99.67%. Report is 4 commits behind head on main.

:exclamation: Current head 4886e08 differs from pull request most recent head 1c8bc48. Consider uploading reports for the commit 1c8bc48 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #730 +/- ## ======================================= Coverage 99.67% 99.67% ======================================= Files 89 89 Lines 6397 6420 +23 ======================================= + Hits 6376 6399 +23 Misses 21 21 ``` | [Files Changed](https://app.codecov.io/gh/NatLibFi/Annif/pull/730?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi) | Coverage Δ | | |---|---|---| | [annif/backend/ensemble.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/730?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvYmFja2VuZC9lbnNlbWJsZS5weQ==) | `100.00% <ø> (ø)` | | | [annif/backend/nn\_ensemble.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/730?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvYmFja2VuZC9ubl9lbnNlbWJsZS5weQ==) | `100.00% <100.00%> (ø)` | | | [annif/backend/svc.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/730?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvYmFja2VuZC9zdmMucHk=) | `100.00% <100.00%> (ø)` | | | [tests/test\_backend\_nn\_ensemble.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/730?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9iYWNrZW5kX25uX2Vuc2VtYmxlLnB5) | `100.00% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/NatLibFi/Annif/pull/730/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 11 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication