Alberto Tono
Alberto Tono

Reputation: 324

TensorBoard: Tutorial Pytorch: module 'tensorflow._api.v2.io.gfile' has no attribute 'get_filesystem'

I am having issues running this tutorial about Pytorch and TensorBoard with Embeddings https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html

I am having this message,

AttributeError                            Traceback (most recent call last)
<ipython-input-10-e0404d94b4cd> in <module>()
     22 writer.add_embedding(features,
     23                     metadata=class_labels,
---> 24                     label_img=images.unsqueeze(1))
     25 writer.close()

/usr/local/lib/python3.6/dist-packages/torch/utils/tensorboard/writer.py in add_embedding(self, mat, metadata, label_img, global_step, tag, metadata_header)
    779         save_path = os.path.join(self._get_file_writer().get_logdir(), subdir)
    780 
--> 781         fs = tf.io.gfile.get_filesystem(save_path)
    782         if fs.exists(save_path):
    783             if fs.isdir(save_path):

and I can visualize the projector

Upvotes: 4

Views: 2296

Answers (1)

korakot
korakot

Reputation: 40948

Try this

import tensorflow as tf
import tensorboard as tb
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile

Upvotes: 5

Related Questions