Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Vertex AI Model Deployment Error

Hi, I just got started using vertex ai with google cloud console. I am trying to deploy this mode to an endpoint. https://tfhub.dev/tensorflow/efficientnet/lite0/feature-vector/2 I successfully imported it into a google storage bucket and uploaded it to the model registry. However, when I attempt to deploy the model to an endpoint, I receive the following error.

Hello Vertex AI Customer,

Due to an error, Vertex AI was unable to create endpoint "Feature Vectors".
Additional Details:
Operation State: Failed with errors
Resource Name: 
**path to project**
Error Messages: Model server terminated: model server container terminated: 
exit_code:       255
reason: "Error"
started_at {
   seconds: 1669817118
}
finished_at {
   seconds: 1669817421
}
. Model server logs can be found at 
**some link**

I have attempted to change the TensorFlow version and the folder that i import (I attempted to import the containing folder instead of the model folder) however nothing seems to help. Any suggestions would be greatly appreciated. Thank you!

Solved Solved
0 3 1,964
1 ACCEPTED SOLUTION

Yep, the solution was pretty simple. 

The trick was to import the model as a tensorflow GraphDef and then export the model with the serve tags included. You can then use this exported model instead of the untagged model. Hope this helps! 

# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from tensorflow.python.platform import gfile

model_file = "./efficientnet_lite0_feature-vector_2/saved_model.pb"

with tf.Session() as sess:

    graph = tf.Graph()
    graph_def = tf.GraphDef()
    with open(model_file, "rb") as f:
        graph_def.ParseFromString(f.read())

    tf.import_graph_def(graph_def)

# Export the model to /tmp/my-model.meta.
meta_graph_def = tf.serve.export_meta_graph(filename='./efficientnet_lite0_feature-vector_2/info.meta')

 

View solution in original post

3 REPLIES 3

Hi,

Can you share the steps on how you are attempting to deploy the model to the endpoint? Or are you following any documentation to do this?

Edz
Bronze 1
Bronze 1

Have you solved this problem? I have the same problem, how did you solve it?

Yep, the solution was pretty simple. 

The trick was to import the model as a tensorflow GraphDef and then export the model with the serve tags included. You can then use this exported model instead of the untagged model. Hope this helps! 

# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from tensorflow.python.platform import gfile

model_file = "./efficientnet_lite0_feature-vector_2/saved_model.pb"

with tf.Session() as sess:

    graph = tf.Graph()
    graph_def = tf.GraphDef()
    with open(model_file, "rb") as f:
        graph_def.ParseFromString(f.read())

    tf.import_graph_def(graph_def)

# Export the model to /tmp/my-model.meta.
meta_graph_def = tf.serve.export_meta_graph(filename='./efficientnet_lite0_feature-vector_2/info.meta')