AttributeError:模块"tensorflow"没有属性"gfile" [英] AttributeError: module 'tensorflow' has no attribute 'gfile'

查看:515
本文介绍了AttributeError:模块"tensorflow"没有属性"gfile"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Google Colab 上使用 tensorflow 2.0 训练了一个简单的mnist模型,并将其保存为 .json 格式. 单击此处来查看我在其中编写代码的Colab Notebook.然后在运行命令

I trained a simple mnist model with tensorflow 2.0 on Google Colab and saved it in the .json format. Click here to check out the Colab Notebook where I've written the code. Then on running the command

!simple_tensorflow_serving --model_base_path="/" --model_platform="tensorflow"

它显示错误AttributeError:模块'tensorflow'没有属性'gfile'

It is showing the error AttributeError: module 'tensorflow' has no attribute 'gfile'

simple_tensorflow_serving 有助于轻松地将训练有素的tensorflow模型部署到生产中.

simple_tensorflow_serving helps in easily deploying trained tensorflow model into production.

版本我正在使用:

(1)TensorFlow-2.0

(1) TensorFlow - 2.0

(2)simple_tensorflow_serving-0.6.4

(2) simple_tensorflow_serving - 0.6.4

预先感谢您:)

推荐答案

由于Tensorflow 2.0使用的是旧版API,因此尚无法为Tensorflow 2.0提供简单的服务. 在Tensorflow 2.0中,gfile软件包已移至tf.io.

Simple Tensorflow Serving is not ready for Tensorflow 2.0, since it is using the old API. In Tensorflow 2.0 the gfile package has been moved into tf.io.

然后,您必须使用简单Tensorflow服务将Tensorflow实例降级为TF 1.13

Then, you have to downgrade your Tensorflow instance to TF 1.13 use Simple Tensorflow Serving

这篇关于AttributeError:模块"tensorflow"没有属性"gfile"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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