簡體   English   中英

pytorch 張量板“add_embedding 錯誤”

[英]pytorch tensorboard “add_embedding error”

每個人。 我被困在 pytorch 中使用張量板。 關鍵是 add_embedding 方法會產生如下錯誤:

Traceback (most recent call last):
  File "test2.py", line 126, in <module>
    writer.add_embedding(features, metadata=class_labels, label_img = images.unsqueeze(1))
  File "/home/dgjung/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 798, in add_embedding
    fs = tf.io.gfile.get_filesystem(save_path)
AttributeError: module 'tensorflow._api.v2.io.gfile' has no attribute 'get_filesystem'

我的代碼是pytorch 教程

# log embeddings
features = images.view(-1, 28 * 28)
writer.add_embedding(features,
                    metadata=class_labels,
                    label_img=images.unsqueeze(1))

我的環境是:

  • PyTorch:“1.7.1”
  • Tensorflow:'2.4.1'
  • Python:3.8.8

LZ,幫幫我!

這是一個令人討厭的小錯誤,需要有人修補。這里有一個關於它的對話

我能夠通過添加來修復它:

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

到第 798 行上方的 torch/utils/tensorboard/writer.py

高能

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM