Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Tensorflow has no attribute 'gfile' even after I changed the file?

I got error AttributeError: module 'tensorflow' has no attribute 'gfile' so I found online that now we have to change tf.gfile to tf.io.gfile
so I changed it in the C:\Anaconda\lib\site-packages\object_detection\utils\config_util.py but still it is not working for me.

Error:

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

C:\Anaconda\lib\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.io.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'

Can anyone can help me out?
I am new to this😅

like image 576
sachuverma Avatar asked Dec 20 '25 09:12

sachuverma


1 Answers

downgrade to tensorflow 2.3.0 by

pip install tensorflow==2.3.0

you can see the diffrent versions from https://www.tensorflow.org/install/source_windows#install_the_package

like image 160
damanpreet singh Avatar answered Dec 22 '25 00:12

damanpreet singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!