We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
tensorflow/tensorflow#70757
Reposting per tensorflow developer's recommendation.
I am encountering the same issue with pip version 2.17
Thank you
The text was updated successfully, but these errors were encountered:
I'm the original poster of the tensorflow issue. Thank you xchen99sdr for reposting it.
Sorry, something went wrong.
input_shape
Sequential
A minimal reproducible script:
from keras import layers from keras import models from keras import ops from keras import saving CONV_WIDTH = 3 model = models.Sequential([layers.Lambda(lambda x: x[:, -CONV_WIDTH:, :])]) x = ops.ones((1, 10, 4)) y = model(x) model.save("model.keras") revived_model = saving.load_model("model.keras", safe_mode=False) # <- failed
A workaround is to directly assign the value instead of using variables in layers.Lambda. I don't know why it caused the issue.
layers.Lambda
from keras import layers from keras import models from keras import ops from keras import saving model = models.Sequential([layers.Lambda(lambda x: x[:, -3:, :])]) # Not using `CONV_WIDTH` x = ops.ones((1, 10, 4)) y = model(x) model.save("model.keras") revived_model = saving.load_model("model.keras", safe_mode=False)
I have submitted a PR #20076 to ultimately fix it. You can also wait for it.
Are you satisfied with the resolution of your issue? Yes No
mehtamansi29
Successfully merging a pull request may close this issue.
tensorflow/tensorflow#70757
Reposting per tensorflow developer's recommendation.
I am encountering the same issue with pip version 2.17
Thank you
The text was updated successfully, but these errors were encountered: