如何使用带pytorch的张力板?

2024-05-06 22:43:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我遵循pytorch tensorboard教程:https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html

但由于以下错误,我甚至无法启动:

from torch.utils.tensorboard import SummaryWriter
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/apps/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py in <module>
      1 try:
----> 2     from tensorboard.summary.writer.record_writer import RecordWriter  # noqa F401
      3 except ImportError:

ModuleNotFoundError: No module named 'tensorboard'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-4-c8ffdef1cfab> in <module>
----> 1 from torch.utils.tensorboard import SummaryWriter
      2 
      3 # default `log_dir` is "runs" - we'll be more specific here
      4 writer = SummaryWriter('runs/fashion_mnist_experiment_1')

~/apps/anaconda3/envs/torch/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py in <module>
      2     from tensorboard.summary.writer.record_writer import RecordWriter  # noqa F401
      3 except ImportError:
----> 4     raise ImportError('TensorBoard logging requires TensorBoard with Python summary writer installed. '
      5                       'This should be available in 1.14 or above.')
      6 from .writer import FileWriter, SummaryWriter  # noqa F401

ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.

我通过康达安装了pytorch 1.14。我应该安装其他东西吗


Tags: infromimportutilstorchpytorchsummarywriter
1条回答
网友
1楼 · 发布于 2024-05-06 22:43:43

该教程可能会让您知道需要安装tensorboard。看一下pytorch tensorboard docs,它解释了您需要首先安装tensorboard

基本上,您可以使用

pip install tensorboard

然后通过运行启动tensorboard服务器

tensorboard  logdir=runs

runs目录是摘要编写器将要写入的目录,也是tensorboard服务器读取内容以了解可视化内容的目录

相关问题 更多 >