8000 Add superclass constructor call to LMDBSequence, to prevent TensorFlow warning by osma · Pull Request #847 · NatLibFi/Annif · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add superclass constructor call to LMDBSequence, to prevent TensorFlow warning #847

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 1 commit into from
Apr 7, 2025

Conversation

osma
Copy link
Member
@osma osma commented Apr 7, 2025

This one-line PR fixes a TensorFlow warning about a missing call to a superclass constructor, for example when running the test suite:

tests/test_backend_nn_ensemble.py::test_nn_ensemble_train_and_learn
tests/test_backend_nn_ensemble.py::test_nn_ensemble_train_cached
tests/test_backend_nn_ensemble.py::test_nn_ensemble_train_and_learn_params
  /home/oisuomin/.cache/pypoetry/virtualenvs/annif-3KgT0m3n-py3.12/lib/python3.12/site-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:121: UserWarning: Your `PyDataset` class should call `super().__init__(**kwargs)` in its constructor. `**kwargs` can include `workers`, `use_multiprocessing`, `max_queue_size`. Do not pass these arguments to `fit()`, as they will be ignored.
    self._warn_if_super_not_called()

The warning message is a bit cryptic because it talks about PyDataset. The nn_ensemble backend doesn't implement a PyDataset, but instead defines the LMDBSequence class that implements Sequence. We forgot to call the superclass constructor in this implementation. Maybe this was a requirement introduced in newer TensorFlow versions?

This was reported by @TobiasNx on annif-users.

@osma osma added the bug label Apr 7, 2025
@osma osma added this to the 1.4 milestone Apr 7, 2025
@osma osma self-assigned this Apr 7, 2025
Copy link
sonarqubecloud bot commented Apr 7, 2025

Copy link
codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (38f5e8a) to head (1abf02f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #847   +/-   ##
=======================================
  Coverage   99.63%   99.63%           
=======================================
  Files          99       99           
  Lines        7350     7351    +1     
=======================================
+ Hits         7323     7324    +1     
  Misses         27       27           

☔ 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.

@osma osma merged commit 27511ed into main Apr 7, 2025
17 checks passed
@osma osma deleted the fix-nn-sequence-super-init branch April 7, 2025 11:11
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.

2 participants
0