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

TF 2.16 Incorrect model with TextVectorization in SavedModel format contains float input type instead of string type #64443

Closed
rkazants opened this issue Mar 25, 2024 · 5 comments
Assignees
Labels
comp:keras Keras related issues stat:awaiting response Status - Awaiting response from author TF 2.16 type:bug Bug

Comments

@rkazants
Copy link

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

2.16.1

Custom code

Yes

OS platform and distribution

No response

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

Model with TextVectorization layer after saving into SavedModel format using tf.saved_model.save contains float32 input instead of string type

Standalone code to reproduce the issue

import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Input, TextVectorization
from tensorflow.keras.models import Model

vocabulary = ['hello', 'there', 'random', 'vocab', 'check']
length = 64

text_input = Input(dtype=tf.string, shape=(1,), name='text_input')
vectorize_layer = TextVectorization(vocabulary=vocabulary, output_mode='int', name='vectorization_layer',
                                    output_sequence_length=length)(text_input)
model = Model(inputs={'text_input': text_input}, outputs=[vectorize_layer])

input_data = np.array([['hello here and there']], dtype=str)
model({'text_input': input_data})

tf.saved_model.save(model, 'my_model')
loaded_model = tf.keras.layers.TFSMLayer('my_model', call_endpoint="serving_default")
loaded_model(input_data)

Relevant log output

ValueError: could not convert string to float: 'hello here and there'
@google-ml-butler google-ml-butler bot added the type:bug Bug label Mar 25, 2024
@rkazants rkazants changed the title Incorrect model with TextVectorization in SavedModel format contains float input type instead of string type TF 2.16 Incorrect model with TextVectorization in SavedModel format contains float input type instead of string type Mar 25, 2024
@tilakrayal tilakrayal added TF 2.16 comp:keras Keras related issues labels Mar 26, 2024
@tilakrayal
Copy link
Contributor

@rkazants,
Thank you for reporting the issue. Looks like this issue is more related to Keras3.0. Kindly find the gist of it here. Could you please create a new issue on keras-team/keras for the quick resolution. Thank you!

@rkazants
Copy link
Author

@rkazants, Thank you for reporting the issue. Looks like this issue is more related to Keras3.0. Kindly find the gist of it here. Could you please create a new issue on keras-team/keras for the quick resolution. Thank you!

Filled here: keras-team/keras#19396

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Mar 28, 2024
@tilakrayal
Copy link
Contributor

@rkazants,
Could you please feel free to move this issue to closed status, since it is already being tracked there. Thank you!

@tilakrayal tilakrayal added the stat:awaiting response Status - Awaiting response from author label Mar 28, 2024
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@rkazants rkazants reopened this Mar 28, 2024
@rkazants rkazants closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2024
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues stat:awaiting response Status - Awaiting response from author TF 2.16 type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants