gpt4 book ai didi

pytorch - ImportError : TensorBoard logging requires TensorBoard version 1. 15 或以上

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

我按照 pytorch.org 中的教程进行操作出现错误:TensorBoard logging requires TensorBoard version 1.15 or above ,但我已经安装了 TensorBoard。代码如下:

#from torch.utils.tensorboard import SummaryWriter
from tensorboardX import SummaryWriter
writer = SummaryWriter('runs/fashion_mnist_experiment_1')
#get some random training images
dataiter = iter(trainloader)
images , labels = dataiter.next()
#create grid of images
img_grid = torchvision.utils.make_grid(images)
matplotlib_imshow(img_grid,one_channel=True)
writer.add_image('four_fashion_images',img_grid)
writer.add_graph(net, images)
writer.close()

错误:

ImportError                               Traceback (most recent call last)
<ipython-input-12-d38808675cb4> in <module>
----> 1 writer.add_graph(net, images)
2 writer.close()

~\anaconda3\envs\torch2\lib\site-packages\tensorboardX\writer.py in add_graph(self, model, input_to_model, verbose)
791
792 """
--> 793 from torch.utils.tensorboard._pytorch_graph import graph
794 self._get_file_writer().add_graph(graph(model, input_to_model, verbose))
795

~\anaconda3\envs\torch2\lib\site-packages\torch\utils\tensorboard\__init__.py in <module>
2 from distutils.version import LooseVersion
3 if not hasattr(tensorboard, '__version__') or LooseVersion(tensorboard.__version__) < LooseVersion('1.15'):
----> 4 raise ImportError('TensorBoard logging requires TensorBoard version 1.15 or above')
5 del LooseVersion
6 del tensorboard

ImportError: TensorBoard logging requires TensorBoard version 1.15 or above

环境:

tensorboard               2.3.0                    pypi_0    pypi
tensorboard-plugin-wit 1.7.0 pypi_0 pypi
tensorboardx 2.1 pypi_0 pypi
tensorflow 1.2.1 py36_0 defaults
pytorch 1.6.0 py3.6_cuda102_cudnn7_0 pytorch
torchvision 0.7.0 py36_cu102 pytorch
future 0.18.2 py36_1 defaults
protobuf 3.12.3 py36h33f27b4_0 defaults

我使用 from torch.utils.tensorboard import SummaryWriter一开始,但出现与上述相同的错误。然后我使用from tensorboardX import SummaryWriter

最佳答案

卸载 tensorflowtensorboardtensorboardxtensorboard-plugin-wit

之后安装 only tensorboardconda

如果这不起作用,请仅使用 tensorboard 重新创建您的 conda 环境。如果你需要 tensorflow 也可以提前安装。

编辑:

tensorboard-plugin-wittensorboard 的依赖项,应该按照它们的 pypi 自动安装安装 tensorboard 本身时的说明。

关于pytorch - ImportError : TensorBoard logging requires TensorBoard version 1. 15 或以上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63357718/

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