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

Saving a Keras model that includes a mixture layer (e.g. MixtureNormal) might be unsafe #1825

Open
jsaladich opened this issue Jul 17, 2024 · 0 comments

Comments

@jsaladich
Copy link

Hi Team,

I am trying to save the weights of a Keras model that end with a MixtureNormal layer. And I get the following warning:

.../keras/src/saving/serialization_lib.py:(line) 159: UserWarning:The object being serialized includes a `lambda`. This is unsafe. In order to reload the object, you will have to pass `safe_mode=False` to the loading function. Please avoid using `lambda` in the future, and use named Python functions instead. This is the `lambda` being serialized:         lambda t: MixtureNormal.new(  # pylint: disable=g-long-lambda
            t, num_components, event_shape, validate_args),

I know that tfp mixture layers have a strong commitment to lambda functions so you can pass tfp distributions. Is this something you plan to work on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant