Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
735 views
in Technique[技术] by (71.8m points)

pytorch - 无法使Pytorch与Tensorboard一起使用(Can not get pytorch working with tensorboard)

I"m going through this tutorial to set up pytorch (v1.3.0 through conda) with tensorboard https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#

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

but on the step

(但是在踩)

from torch.utils.tensorboard import SummaryWriter

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

I keep getting the error

(我不断收到错误)

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
C:ProgramDataAnaconda3envsfastai_v1libsite-packagesorchutilsensorboard\__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:UsersmattDocumentscodeplaygroundensorboard.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:ProgramDataAnaconda3envsfastai_v1libsite-packagesorchutilsensorboard\__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.

Does anyone have any suggestions?

(有没有人有什么建议?)

  ask by foobar8675 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I came across the same error, I solved by taking the following steps:

(我遇到了同样的错误,我通过执行以下步骤解决了:)

  1. Removed all installation of Tensorflow or Tensorboard from the conda environment.

    (从conda环境中删除了所有的Tensorflow或Tensorboard安装。)

  2. Then by activating the same conda environment, type "pip install -U tb-nightly"

    (然后通过激活相同的conda环境,键入“ pip install -U tb-nightly”)

  3. Then type, "pip install -U future"

    (然后输入“ pip install -U future”)

  4. done

    (完成)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...