Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos
MIT License
9.28k stars 4.19k forks source link

AttributeError: module 'tensorflow' has no attribute 'gfile' in style transfer notebook #117

Closed MianUmair001 closed 4 years ago

MianUmair001 commented 4 years ago

I am getting this error while running the last cell of this code %%time img = style_transfer(content_image=content_image, style_image=style_image, content_layer_ids=content_layer_ids, style_layer_ids=style_layer_ids, weight_content=1.5, weight_style=10.0, weight_denoise=0.3, num_iterations=60, step_size=10.0) 15

m4-k131 commented 4 years ago

Use tf.io.gfile.GFile

Hvass-Labs commented 4 years ago

Thanks for the error report. I'm guessing this is perhaps part of the TF2 update. Please test the proposed fix and let me know if everything else is working with this Notebook.

Hvass-Labs commented 4 years ago

This is a problem within the pre-trained model or some other old TensorFlow code that was used in that tutorial. It would take too much effort to update it to TensorFlow 2, so if you want to run it, you will have to use an older TensorFlow 1 version.