-
Notifications
You must be signed in to change notification settings - Fork 196
Fix fmpe singularity on sde sampling #1661
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
Conversation
Running IID tests locally to check if the skip in FMPE can be removed. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1661 +/- ##
==========================================
- Coverage 86.70% 82.59% -4.12%
==========================================
Files 134 134
Lines 11150 11151 +1
==========================================
- Hits 9668 9210 -458
- Misses 1482 1941 +459
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Pull Request Overview
This PR fixes numerical singularities in the Flow Matching Posterior Estimation (FMPE) that caused unstable SDE sampling trajectories. The fix changes the singularity bound from 1e-6 to 1e-2 to prevent drift/diffusion explosions.
- Increased singularity bounds in drift and diffusion functions from 1e-6 to 1e-2
- Fixed dimension concatenation bug in diffuser intermediate sample handling
- Added save_intermediate parameter to vector field posterior sampling interface
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
sbi/neural_nets/estimators/flowmatching_estimator.py | Updated singularity bounds in drift_fn and diffusion_fn to prevent numerical explosions |
sbi/samplers/score/diffuser.py | Fixed concatenation dimension from 0 to 1 for intermediate samples |
sbi/inference/posteriors/vector_field_posterior.py | Added save_intermediate parameter to diffusion sampling method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Skipped tests here
sbi/tests/linearGaussian_vector_field_test.py
Lines 376 to 382 in bdf7d83
if ( | |
vector_field_type == "fmpe" | |
and prior_type == "uniform" | |
and iid_method in ["gauss", "auto_gauss", "jac_gauss"] | |
): | |
# TODO: Predictor produces NaNs for these cases, see #1656 | |
pytest.skip("Known issue of IID methods with uniform priors, see #1656.") |
please double check whether it all passes locally.
Okay In FMPE at t=1 this became zero, which rendered some of the analytical equations used in IID setting ill-defined (as then there is nothing to denoise). |
Will run the test without the skip and remove it once passing. |
For me, the three iid |
Where you on the most recent commit? (before the last one) `The mean_t_fn modification was necessary. Will check again, but for me all tests did pass. |
Yes, all passing now. thanks! 🚀 |
This aims to fix an inefficiency in FMPE drift/diffusion definitions. This lead to unhealthy sampling trajectories (SDE divergence in the beginning). This should generally improve sampling with SDE on FMPE, but also likely fix #1656 .