gpt4 book ai didi

python - torch 张量板 "add_embedding error"

转载 作者:行者123 更新时间:2023-12-05 06:50:00 26 4
gpt4 key购买 nike

大家。我一直坚持在 pytorch 中使用 tensorboard。关键是 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 tutorial .

# 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

PLZ,帮帮我!

最佳答案

这是一个令人讨厌的小错误,需要有人修补..有一个关于它的对话here

我能够通过添加来修复它:

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

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

ghf

关于python - torch 张量板 "add_embedding error",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66490589/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com