[오류 해결] AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'get_filesystem'

hottogi·2023년 1월 13일
0

torch.utils.tensorboard 내의 SummaryWriter 함수 사용시 다음과 같은 오류 발생

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-370c2467b86e> in <module>
     16 
     17 features = images.view(-1, 28 * 28)
---> 18 writer.add_embedding(features,
     19                     metadata=class_labels,
     20                     label_img=images.unsqueeze(1))

/usr/local/lib/python3.8/dist-packages/torch/utils/tensorboard/writer.py in add_embedding(self, mat, metadata, label_img, global_step, tag, metadata_header)
    924         save_path = os.path.join(self._get_file_writer().get_logdir(), subdir)
    925 
--> 926         fs = tf.io.gfile.get_filesystem(save_path)
    927         if fs.exists(save_path):
    928             if fs.isdir(save_path):

AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'get_filesystem'

아래 코드 추가 시 오류 해결

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

0개의 댓글