Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Refactorsimulate_for_sbi location#1253

Merged

Conversation

samadpls
Copy link
Contributor

What does this implement/fix? Explain your changes

Move simulate_for_sbi to utils

Does this close any currently open issues?

Fixes#1240

Checklist

Put anx 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 thecontribution
    guidelines
  • I agree with re-licensing my contribution from AGPLv3 to Apache-2.0.
  • 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
    withpytest.mark.slow.
  • New and existing unit tests pass locally with my changes
  • I performed linting and formatting as described in thecontribution
    guidelines
  • I rebased onmain (or there are no conflicts withmain)
  • For reviewer: The continuous deployment (CD) workflow are passing.

@codecovCodecov
Copy link

codecovbot commentedAug 30, 2024
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.33%. Comparing base(8afd985) to head(47768a3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #1253      +/-   ##==========================================- Coverage   86.05%   78.33%   -7.73%==========================================  Files         118      119       +1       Lines        8672     8685      +13     ==========================================- Hits         7463     6803     -660- Misses       1209     1882     +673
FlagCoverage Δ
unittests78.33% <100.00%> (-7.73%)⬇️

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

Files with missing linesCoverage Δ
sbi/inference/__init__.py100.00% <100.00%> (ø)
sbi/inference/trainers/base.py92.54% <100.00%> (+5.63%)⬆️
sbi/utils/simulation_utils.py100.00% <100.00%> (ø)

... and28 files with indirect coverage changes

Copy link
Contributor

@janfbjanfb left a comment

Choose a reason for hiding this comment

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

That looks good, thanks a lot!

Now that you have moved the code,codecov notices that parts of thesimulate_for_sbi function are not covered in tests.

Would you be up for writing a test that testssimulate_for_sbi with different cases, e.g., withnum_simulations=0,simulation_batch_size=None,num_workers>1, usingpytest.mark.parametrize?

You could just use alinear_gaussian simulator as in the other tests.
Ideally, you would also add one case where we runprocess_simulator and one where we don't, to cover theTypeError case whennum_workers>1.

Let me know whether anything is unclear, or if you prefer not adding this (then I can easily add it in a separate PR).

Thanks again, cheers,
Jan

samadpls reacted with heart emoji
@samadpls
Copy link
ContributorAuthor

Thanks a lot for the feedback!
I’ve added the tests for simulate_for_sbi covering various cases. Let me know if there’s anything else!

Copy link
Contributor

@janfbjanfb left a comment

Choose a reason for hiding this comment

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

Great! thanks for adding the test as well.

I added a couple of comments. Regarding theTypeError handling, we just need to cover the case where the user passes a torch simulator withnum_workers>1 without processing this simulator usingprocess_simulator before. In that case, a TypeError will occur, be handled internally and then raised again. See comment, and let me know if anything is unclear.
Thanks!

samadpls reacted with rocket emoji
Signed-off-by: samadpls <abdulsamadsid1@gmail.com>
Signed-off-by: samadpls <abdulsamadsid1@gmail.com>
Signed-off-by: samadpls <abdulsamadsid1@gmail.com>
@samadplssamadplsforce-pushed therefactor/simulate_for_sbi-location branch frome80f9ac to39a83b9CompareSeptember 2, 2024 19:20
Signed-off-by: samadpls <abdulsamadsid1@gmail.com>
@samadplssamadplsforce-pushed therefactor/simulate_for_sbi-location branch from39a83b9 to47768a3CompareSeptember 2, 2024 19:49
Copy link
Contributor

@janfbjanfb left a comment

Choose a reason for hiding this comment

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

Awesome, this looks good!
Thanks a lot 🙏

samadpls reacted with hooray emoji
@janfbjanfb merged commit033a05e intosbi-dev:mainSep 3, 2024
6 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@janfbjanfbjanfb approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

simulate_for_sbi lives intrainers
2 participants
@samadpls@janfb

[8]ページ先頭

©2009-2025 Movatter.jp