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

Refactor CI tests for speed #923

Merged
merged 12 commits into from
Jan 26, 2024
Merged

Refactor CI tests for speed #923

merged 12 commits into from
Jan 26, 2024

Conversation

janfb
Copy link
Contributor

@janfb janfb commented Jan 26, 2024

The "fast" tests we run for CI became quite slow: pytest -m "not slow and not gpu"

To speed them up I removed a couple of duplicate tests and used better MCMC parameters.
The biggest speed up comes from using slice_np_vectorized with many chains and few warm up steps (when posterior accuracy is not tested).

The speed up is about 30%.
@michaeldeistler can you confirm by testing on main and on this branch locally?

I separated commits per test file to be able to correct potential misses. We can squash the commits when merging.

TODO:

  • check test coverage

@janfb janfb added the enhancement New feature or request label Jan 26, 2024
@janfb janfb self-assigned this Jan 26, 2024
@michaeldeistler
Copy link
Contributor

Thanks! Running the tests now.

Copy link
Contributor

@michaeldeistler michaeldeistler left a comment

Choose a reason for hiding this comment

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

On my MBP with M3 the timings are 422.69s vs 170.27s. Awesome!

tests/linearGaussian_snle_test.py Outdated Show resolved Hide resolved
tests/linearGaussian_snle_test.py Show resolved Hide resolved
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9e224da) 75.46% compared to head (bd4c83b) 75.28%.

Files Patch % Lines
sbi/inference/posteriors/mcmc_posterior.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #923      +/-   ##
==========================================
- Coverage   75.46%   75.28%   -0.18%     
==========================================
  Files          80       80              
  Lines        6284     6284              
==========================================
- Hits         4742     4731      -11     
- Misses       1542     1553      +11     
Flag Coverage Δ
unittests 75.28% <33.33%> (-0.18%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@janfb janfb changed the title Refactor CI tests Refactor CI tests for speed Jan 26, 2024
@janfb janfb merged commit c607e9a into main Jan 26, 2024
1 of 3 checks passed
@janfb janfb deleted the profile-tests branch January 26, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants