'Tensorflow tf.gfile.GFile

I have tried changing tf.gfile.GFile to tf.io.gfile.GFile and also tried import tensorflow.compat.v1 as tf but nothing worked. It is not reading the newly saved file. I have saved it after changes.

AttributeError                            Traceback (most recent call last)
<ipython-input-52-efc7822bb0d7> in <module>
----> 1 config = config_util.get_configs_from_pipeline_file(CONFIG_PATH)

~/opt/anaconda3/lib/python3.8/site-packages/object_detection/utils/config_util.py in get_configs_from_pipeline_file(pipeline_config_path, config_override)
     94   """
     95   pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
---> 96   with tf.gfile.GFile(pipeline_config_path, "r") as f:
     97     proto_str = f.read()
     98     text_format.Merge(proto_str, pipeline_config)

AttributeError: module 'tensorflow' has no attribute 'gfile''''



Solution 1:[1]

Change it to tf.io.gfile.GFile.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user13973948