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

weight damage in .keras format #19060

Open
innat opened this issue Jan 16, 2024 · 3 comments
Open

weight damage in .keras format #19060

innat opened this issue Jan 16, 2024 · 3 comments
Assignees
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer To investigate Looks like a bug. It needs someone to investigate. type:others

Comments

@innat
Copy link

innat commented Jan 16, 2024

Packages

  • Keras-nightly

Describe

  • Saved model in .keras format
  • Reload it to check similarity but weight missmatch.

Gist

Others

Potential similar issue. #19019

@SuryanarayanaY
Copy link
Contributor

Hi @innat ,

I have replicated the reported behaviour with tensorflow and torch backends also. Attaching gist-tf and gist-torch.

Note: I tested with explicit serialization/deserialization for custom objects and still behaviour is same. Need to check the reason for this behaviour.

@SuryanarayanaY SuryanarayanaY added the To investigate Looks like a bug. It needs someone to investigate. label Jan 16, 2024
@innat
Copy link
Author

innat commented Jan 16, 2024

@SuryanarayanaY Thank you for the response. One of the suspected area in the code is mention below (possibly). Coz, if I save the Attention module itself to .keras format, it works (as far as I remember).

    def build(self, input_shape):
        self.safe_window_size = get_window_size(
            input_shape[1:-1], self.window_size
        )
        self.attention_layer = Attention(
            dim=self.dim,
            window_size=self.safe_window_size,
            num_heads=self.num_heads,
            qkv_bias=self.qkv_bias,
            qk_scale=self.qk_scale,
            attn_drop_rate=self.attn_drop_rate,
            proj_drop_rate=self.proj_drop_rate
        )

This is what I stated in this old ticket. tbh, the new saving strategy in keras 3 is bit confusing than before.

Let me know if I need to add any information.

@SuryanarayanaY SuryanarayanaY added the keras-team-review-pending Pending review by a Keras team member. label Jan 23, 2024
@qlzh727 qlzh727 removed the keras-team-review-pending Pending review by a Keras team member. label Jan 25, 2024
@SuryanarayanaY SuryanarayanaY added the stat:awaiting keras-eng Awaiting response from Keras engineer label Jan 31, 2024
@innat
Copy link
Author

innat commented Feb 8, 2024

Any update? cc. @nkovela1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting keras-eng Awaiting response from Keras engineer To investigate Looks like a bug. It needs someone to investigate. type:others
4 participants