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

Automatic Serialization #323

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft

Automatic Serialization #323

wants to merge 5 commits into from

Conversation

LarsKue
Copy link
Contributor

@LarsKue LarsKue commented Feb 19, 2025

The goals of this PR are:

  • Remove the need to implement from_config and get_config methods for most objects
  • Remove the need to save a config object in the constructor of most objects
  • Unify the serialization of types, functions, and other objects
  • Improve the serialization of functions, especially with respect to numpy

To achieve the above goals, this PR introduces:

  • A custom serialize and deserialize function that wrap around the keras utilities
  • A custom serializable decorator that automatically implements from_config and get_config

@LarsKue LarsKue self-assigned this Feb 19, 2025
@LarsKue LarsKue added the sugar Syntactical sugar or quality of life improvements label Feb 19, 2025
@LarsKue LarsKue added this to the BayesFlow 2.0 milestone Feb 19, 2025
@stefanradev93
Copy link
Contributor

That's a super nice utility! Which networks are already tested through?

@LarsKue
Copy link
Contributor Author

LarsKue commented Feb 19, 2025

It's still in progress, so not functional for all networks yet. But I made changes such that most networks should already be tested.

@vpratz
Copy link
Collaborator

vpratz commented Feb 20, 2025

This looks really nice! Please take care when removing get_config functions, some attributes might accumulate state that is not automatically serialized by Keras, so already serializing them when __init__ is called might not be sufficient. I'm not totally sure, but I think this might apply for example for ContinuousApproximator.adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sugar Syntactical sugar or quality of life improvements
Projects
Status: Future
Development

Successfully merging this pull request may close these issues.

3 participants