如何在pytorch中使用张量板?

问题描述 投票:1回答:1

我正在遵循pytorch张量板教程: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.

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

python python-3.x pytorch tensorboard
1个回答
0
投票

他们可能应该让您知道该教程中需要安装tensorboard。看看pytorch tensorboard docs,它说明您需要先安装张量板。

基本上您可以使用]安装tensorboard>

pip install tensorboard

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

tensorboard --logdir=runs

其中runs是您的摘要编写器将输出内容的目录,并且张量板服务器希望在其中了解要可视化的目录。

© www.soinside.com 2019 - 2024. All rights reserved.