I'm trying to load a .pb file generated from pusher tfx pipeline. I'm using the following function to load the file, but I got the following error from the function. Please help.
error:
<ipython-input-40-af7ef7ac8a8b> in load_model()
2 with tf.compat.v2.io.gfile.GFile('/home//saved_model.pb', "rb") as f:
3 graph_def = tf.compat.v1.GraphDef()
----> 4 graph_def.ParseFromString(f.read())
5
6 with tf.Graph().as_default() as graph:
DecodeError: Error parsing message
Function
def load_model():
with tf.compat.v2.io.gfile.GFile('/home/saved_model.pb', "rb") as f:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(f.read())
with tf.Graph().as_default() as graph:
tf.import_graph_def(graph_def, name="")
return graph