-
Notifications
You must be signed in to change notification settings - Fork 161
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
Uniform and better MCMC params for the tests #1107
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
94a3c80
Better MCMC hparams
famura c9f5564
MCMC testing for adults
famura 8850a31
Reducing the computational load
famura 7f3fb4c
What? that wasn't even a test
famura bfda70e
Marking more MCMC tests
famura 69deeba
Merge remote-tracking branch 'origin/main' into fix/snre_test_mcmc_inf
famura 8a82766
Merge branch 'main' into fix/snre_test_mcmc_inf
famura 54b5fab
No speedup for num_chains 3->10 with slice_np_vectorized seen in test
famura 5db31d7
Minor edits; test_slice.py will be deleted in another PR anyway
famura 69617de
Formatted
famura 047e393
use separate mcmc param fixtures; small fixes to slow mcmc tests.
janfb 70a8912
Deleted unnecessary override
famura 7e1aa1a
Fix ruff errors from main
manuelgloeckler 84a6bd8
fix gpu test
janfb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,10 @@ | |
from tests.test_utils import check_c2st | ||
|
||
|
||
def test_mdn_with_snpe(): | ||
mdn_inference_with_different_methods(SNPE) | ||
|
||
|
||
@pytest.mark.slow | ||
def test_mdn_with_snle(): | ||
mdn_inference_with_different_methods(SNLE) | ||
|
||
|
||
def mdn_inference_with_different_methods(method): | ||
@pytest.mark.parametrize( | ||
"method", (SNPE, pytest.param(SNLE, marks=[pytest.mark.slow, pytest.mark.mcmc])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
) | ||
def test_mdn_inference_with_different_methods(method, mcmc_params_accurate: dict): | ||
num_dim = 2 | ||
x_o = torch.tensor([[1.0, 0.0]]) | ||
num_samples = 500 | ||
|
@@ -68,9 +62,7 @@ def simulator(theta: Tensor) -> Tensor: | |
theta_transform=theta_transform, | ||
proposal=prior, | ||
method="slice_np_vectorized", | ||
num_chains=20, | ||
warmup_steps=50, | ||
thin=5, | ||
**mcmc_params_accurate, | ||
) | ||
|
||
samples = posterior.sample((num_samples,), x=x_o) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. How long do the MCMC tests run, currently?
Edit: I see these are the current tests but with an additional flag. So its fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without
-n auto
about 850s on my machine (this includesslow
). with-n auto
it's 4500s. I will need to investigate this further, but I can imagine that with multiple chains, we might cause more harm than good with test parallelization. this could interest you, too @BaschdlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we could think about running the mcmc tests sequentially (e.g. in CI) but a more sustainable solution might be to add a
pytest.mark
for tests that should only be executed sequentially. At this point, a legitimate question would be whether the parallelization of the tests brings enough benefit to outweigh the maintenance cost.