AttributeError: module 'tensorflow' has no attribute 'gfile'
In 2.0, tf.gfile.* is replaced by tf.io.gfile.*.
when I get error:
File "/Users/MRJ/anaconda3/envs/python37-tf2.1/lib/python3.7/
site-packages/object_detection/utils/label_map_util.py",
line 137, in load_labelmap
with tf.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'
1.Find label_map_util.py
line 137.
2.Replace tf.gfile.GFile
to tf.io.gfile.GFile
It's worked for me.
tensorflow issue #31315
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
.
Then, you have to downgrade your Tensorflow instance to TF 1.13 use Simple Tensorflow Serving
Instead, try
tf.io.gfile.GFile(
name, mode='r'
)
i.e ".io" will solve your all problems instead of downgrading your tf