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

16.2 Prepare Keras model for Tensorflow Serving - TensorFlow 2.0 Compatibility Issue #81

Open
mikechen66 opened this issue May 12, 2020 · 0 comments

Comments

@mikechen66
Copy link

1. TypeError:

Issue:

TypeError: compile() missing 1 required positional argument: 'optimizer'

Solution:

In [2]:
change the following line of code

new_model.compile()

to the line of code as follows.

new_model.compile(optimizer='rmsprop',loss='mse')

2. AttributeError

Issue

AttributeError: module 'tensorflow' has no attribute 'Session'

Solution:

change the line of code

In[2]

sess = tf.Session()

to the following code

sess = tf.compat.v1.Session()

3. RuntimeError

Issue:

RuntimeError: set_session is not available when using TensorFlow 2.0.

Solution:

delete the following code:

In [2]

K.set_session(sess)

3. AttributeError:

AttributeError: module 'tensorflow_core._api.v2.saved_model' has no attribute 'utils'

In [6]

input_info = tf.saved_model.utils.build_tensor_info(new_model.inputs[0])

The error is hard to be corrected. It has many dependencies. Now I have no solution to the AttributeError.

AttributeError: module 'tensorflow_core._api.v2.saved_model' has no attribute 'utils'

In[7]

classification_inputs = tf.saved_model.utils.build_tensor_info(serialized_tf_example)
classification_outputs_classes = tf.saved_model.utils.build_tensor_info(prediction_classes)
classification_outputs_scores = tf.saved_model.utils.build_tensor_info(values)
@mikechen66 mikechen66 changed the title 16.2 Prepare Keras model for Tensorflow Serving - TensorFlow Compatibility Issue 16.2 Prepare Keras model for Tensorflow Serving - TensorFlow 2.0Compatibility Issue May 12, 2020
@mikechen66 mikechen66 changed the title 16.2 Prepare Keras model for Tensorflow Serving - TensorFlow 2.0Compatibility Issue 16.2 Prepare Keras model for Tensorflow Serving - TensorFlow 2.0 Compatibility Issue May 12, 2020
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