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

Trouble in saving the Keras model to the Bentoml model store #4631

Open
rxiaogit opened this issue Apr 1, 2024 · 0 comments
Open

Trouble in saving the Keras model to the Bentoml model store #4631

rxiaogit opened this issue Apr 1, 2024 · 0 comments

Comments

@rxiaogit
Copy link

rxiaogit commented Apr 1, 2024

Versions installed on Windows 11 desktop:
bentoml 1.2.9
keras 3.1.1
tensorflow 2.16.1

The Issue:
After training a Keras model of CNN with the MNIST dataset, need to save the trained Keras model
to the Bentoml model store, but always got the ValueError complaining about the arguments of ['signatures', 'options']
not supported, though those were never passed as arguments in the save_model() call.

See the python codes below:

def main():

import bentoml
import tensorflow as tf
from tensorflow import keras

"""Trains a model for classifying digits using the MNIST dataset."""
train_images, train_labels, test_images, test_labels = prepare_mnist_training_data()

model = build_convnet_model(INPUT_SHAPE, NUM_CLASSES)

model = train_model(
    model, train_images, train_labels, test_images, test_labels, NUM_EPOCHS
)

# save the model to bento model store 
# model.save("cnn_model.keras")

bentoml.keras.save_model("keras_cnn", model)

if name == "main":
main()

And the error messages when running above codes:

Traceback (most recent call last):
File "C:\Users\rxiao\Tensorflow-Tutorial\mldeployment\mldeployment\training.py", line 138, in
main()
File "C:\Users\rxiao\Tensorflow-Tutorial\mldeployment\mldeployment\training.py", line 134, in main
bentoml.keras.save_model("keras_cnn", model)
File "C:\Users\rxiao\anaconda3\envs\tf\Lib\site-packages\bentoml_internal\frameworks\keras.py", line 267, in save_model
model.save(
File "C:\Users\rxiao\AppData\Roaming\Python\Python311\site-packages\keras\src\utils\traceback_utils.py", line 123, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\rxiao\AppData\Roaming\Python\Python311\site-packages\keras\src\models\model.py", line 309, in save
raise ValueError(
ValueError: The following argument(s) are not supported: ['signatures', 'options']

Is there a bug in the bentoml._internal.frameworks.keras library?
Or What else do I miss here?

Thanks in advance for your help!!

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