nicknochnack / TFODCourse

957 stars 924 forks source link

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

Open jkolosowski opened 12 months ago

jkolosowski commented 12 months ago

Getting this error, followed up this one https://github.com/tensorflow/tensorflow/issues/31315 changing tf.io.gfile and no luck, any ideas?

File ~/TFODCourse/tfod/lib/python3.10/site-packages/object_detection/utils/config_util.py:96, in get_configs_from_pipeline_file(pipeline_config_path, config_override)
     82 """Reads config from a file containing pipeline_pb2.TrainEvalPipelineConfig.
     83 
     84 Args:
   (...)
     93     corresponding config objects.
     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'
JT-Studios commented 10 months ago

Replace:

with tf.gfile.GFile(pipeline_config_path, "r") as f:

With:

with tf.io.gfile.GFile(pipeline_config_path, "r") as f:

Do this in config_util.py