无法部署Cloud ML模型 [英] Unable to deploy a Cloud ML model

查看:75
本文介绍了无法部署Cloud ML模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我尝试将训练有素的模型部署到Google Cloud ML时,出现以下错误:

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?

推荐答案

部署在CloudML上的Tensorflow模型没有名为"inputs"的集合.此集合应为图形命名所有输入张量.同样,需要一个名为"outputs"的集合来命名图形的输出张量.假设您的图形具有两个输入张量x和y,以及一个输出张量分数,则可以按照以下步骤进行操作:

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}))

此处"x","y"和分数"成为实际张量名称(x.name,y.name和scores.name)的别名

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

这篇关于无法部署Cloud ML模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆