Vijay Subramani
Vijay Subramani

Reputation: 105

Unable to deploy a Cloud ML model

Why I try to deploy my trained model to Google Cloud ML, I get the following error:

Create Version failed.Model validation failed: Model metagraph does not have inputs collection.

What does this mean and how to get around this?

Upvotes: 3

Views: 359

Answers (1)

Vijay Subramani
Vijay Subramani

Reputation: 105

The Tensorflow model deployed on CloudML did not have a collection named “inputs”. This collection should name all the input tensors for your graph. Similarly, a collection named “outputs” is required to name the output tensors for your graph. Assuming your graph has two input tensors x and y, and one output tensor scores, this can be done as follows:

tf.add_to_collection(“inputs”, json.dumps({“x” : x.name, “y”: y.name}))
tf.add_to_collection(“outputs”, json.dumps({“scores”: scores.name}))

Here “x”, “y” and “scores” become aliases to the actual tensor names (x.name, y.name and scores.name)

Upvotes: 2

Related Questions