gpt4 book ai didi

python - 无法让 pytorch 与张量板一起工作

转载 作者:行者123 更新时间:2023-12-04 11:15:32 25 4
gpt4 key购买 nike

我正在通过本教程使用张量板设置 pytorch(v1.3.0 通过 conda)https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#

但在台阶上

from torch.utils.tensorboard import SummaryWriter

# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter('runs/fashion_mnist_experiment_1')

我不断收到错误
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
1 try:
----> 2 from tensorboard.summary.writer.record_writer import RecordWriter # noqa F401
3 except ImportError:

ModuleNotFoundError: No module named 'tensorboard.summary'; 'tensorboard' is not a package

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
c:\Users\matt\Documents\code\playground\tensorboard.py in
----> 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')

C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
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.

有没有人有什么建议?

最佳答案

错误日志说,除其他外,

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



因此,当它尝试导入 TensorBoard 时,它无法这样做,因为它在搜索路径中缺少它。您可以安装最新版本(无需指定任何版本号),如下所示:
$ conda install -c conda-forge tensorboard

除此之外,您可能还需要安装 protobuf:
$ conda install -c conda-forge protobuf

这些安装应该修复 ImportError s。

关于python - 无法让 pytorch 与张量板一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58686400/

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