-
Notifications
You must be signed in to change notification settings - Fork 59
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
Keras 3: Streamlined Backend #159
Conversation
@LarsKue Thank you so much! This already looks amazing! Could you perhaps add a simple fully runnable example here for people to get started playing around with it? It is kind of there above, but I think it would make things easier to have one chunk of example code to copy and edit from there. Everyone, please try out the new interface and tell us what you think! |
@paul-buerkner Yes, I am working on it. I hope I have one ready today. |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Great work!! 👏 I'll write down some thoughts on the installation process. Those don't need any changes in the streamlined codebase but are just reminders for our future selves shortly before the release.
|
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Cleaned lotka_volterra.py
Added inverse_kinematics.py. Updated docs in benchmark.py.
Cleaned lotka_volterra.py. Cleaned sir.py.
Added remaining benchmarks: bernoulli_glm.py bernoulli_glm_raw.py gaussian_linear.py gaussian_linear_uniform.py gaussian_mixture.py slcp.py slcp_distractors.py
ruff E741: fixed ambiguous variables names
Benchmarks refactor
Loss progress tests
Notebook linting errors fix
Added test_sequential_simulators to test_simulators/test_simulators.py. Removed extra whitespace in seqential_simulator.py Co-authored-by: Lars <[email protected]>
CIF Implementation
I did some rough manual tests, but we still need automated tests for these
this was too unreliable
…kend # Conflicts: # bayesflow/amortizers.py # bayesflow/configuration.py # bayesflow/helper_networks.py # bayesflow/losses.py # bayesflow/simulation.py # examples/TwoMoons_Bimodal_Posterior.ipynb # pyproject.toml # requirements_dev.txt
🚀 |
For Users
This PR contains a complete overhaul of BayesFlow for version 2.0. The primary features introduced with this PR are listed below. However, instead of reading all of this, we really recommend just diving straight in with an example.
Multi-Backend support via Keras 3
KERAS_BACKEND
environment variable before importing BayesFlow:Note that this requires:
New to deep learning? We recommend starting out with PyTorch for debugging and moving to JAX once your code runs to gain maximum performance.
Introduce a Keras-idiomatic training pattern
Keras provides access to a lot of deep learning utilities, like Multi-GPU training, worker-process data loading, multi-batch gradient accumulation, metric logging, ... To facilitate this, we
bayesflow.datasets
)AmortizedPosterior
and similar models as Keras 3 modelsIntroduce a user-friendly, named-parameter data flow
Many-parameter inference can get confusing, particularly when users have to deal with BayesFlow-internal keys, like
prior_draws
,sim_data
, or most infamously,batchable_context
andnon_batchable_context
. To make this easier, we{parameter_name: parameter_value}
Examples
Check out the example notebooks. We will add more example notebooks as time goes on.
For Devs
There are many internal changes in this PR aimed at facilitating a fast and structured development process:
pytest
,tox
and GitHub workflowsenvironment.yaml