-
Notifications
You must be signed in to change notification settings - Fork 332
Open
Description
signature = tf.saved_model.signature_def_utils.predict_signature_def(
inputs={'image_bytes': model.input}, outputs={'scores': model.output})
builder = tf.saved_model.builder.SavedModelBuilder('model.pb')
builder.add_meta_graph_and_variables(
sess=K.get_session(),
tags=[tf.saved_model.tag_constants.SERVING],
signature_def_map={
tf.saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY:
signature
})
builder.save()
gives error:
AttributeError Traceback (most recent call last)
Cell In[10], line 1
----> 1 signature = tf.saved_model.signature_def_utils.predict_signature_def(
2 inputs={'image_bytes': model.input}, outputs={'scores': model.output})
4 builder = tf.saved_model.builder.SavedModelBuilder('model.pb')
5 builder.add_meta_graph_and_variables(
6 sess=K.get_session(),
7 tags=[tf.saved_model.tag_constants.SERVING],
(...)
10 signature
11 })
AttributeError: module 'tensorflow._api.v2.saved_model' has no attribute 'signature_def_utils'
i tried to covert as follows:
pre_model = tf.keras.models.load_model("model.h5")
pre_model.save("saved_model.pb")
it works but i dont think it is correct as i see:
2023-04-11 12:53:29.259069: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'inputs' with dtype float and shape [?,64]
[[{{node inputs}}]]
2023-04-11 12:53:30.286215: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'inputs' with dtype float and shape [?,64]
[[{{node inputs}}]]
WARNING:absl:Found untraced functions such as _update_step_xla, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op while saving (showing 5 of 28). These functions will not be directly callable after loading.
Metadata
Metadata
Assignees
Labels
No labels