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

Remove deprecated neural_net access from utils #1302

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

tvwenger
Copy link
Contributor

@tvwenger tvwenger commented Nov 7, 2024

What does this implement/fix? Explain your changes

This PR addresses the circular import issue described in #1301 by simply removing the deprecated code in sbi.utils.get_nn_models.py.

Does this close any currently open issues?

Fixes # #1301

Any relevant code examples, logs, error output, etc?

Now

from from sbi.neural_nets import posterior_nn

works as intended.

Any other comments?

Removing this deprecated code will break backwards-compatibility with users who still use the from sbi.utils import posterior_nn syntax.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.

  • I have read and understood the contribution
    guidelines
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have reported how long the new tests run and potentially marked them
    with pytest.mark.slow.
  • New and existing unit tests pass locally with my changes
  • I performed linting and formatting as described in the contribution
    guidelines
  • There are no conflicts with the main branch

For the reviewer:

  • I have reviewed every file
  • All comments have been addressed.

Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

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

This makes sense, it's time to get rid of get_nn_models altogether. thanks for the fix!

Could you please also remove the test file at tests/neural_nets_factory.py testing the deprecation warning for get_nn_models?

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.46%. Comparing base (18b1141) to head (d0a24e9).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1302       +/-   ##
===========================================
- Coverage   89.30%   78.46%   -10.85%     
===========================================
  Files         119      118        -1     
  Lines        8725     8716        -9     
===========================================
- Hits         7792     6839      -953     
- Misses        933     1877      +944     
Flag Coverage Δ
unittests 78.46% <ø> (-10.85%) ⬇️

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

Files with missing lines Coverage Δ
sbi/utils/__init__.py 100.00% <ø> (ø)

... and 32 files with indirect coverage changes

@tvwenger
Copy link
Contributor Author

tvwenger commented Nov 8, 2024

Could you please also remove the test file at tests/neural_nets_factory.py testing the deprecation warning for get_nn_models?

Done @janfb!

Copy link
Contributor

@janfb janfb left a comment

Choose a reason for hiding this comment

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

Looks all good now. Many thanks for solving this nasty circular import problem 🙏

@janfb janfb merged commit 3ff1f51 into sbi-dev:main Nov 13, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants