add_graph error
Weipeilang opened this issue · 3 comments
When I'm using Add_ Graph, This error has occurred in the system
`import torch
import torch.nn as nn
from tensorboardX import SummaryWriter
class LeNet(nn.Module):
def init(self):
super(LeNet, self).init()
self.conv1 = nn.Sequential( # input_size=(12828)
nn.Conv2d(1, 6, 5, 1, 2),
nn.ReLU(), # (62828)
nn.MaxPool2d(kernel_size=2, stride=2), # output_size=(61414)
)
self.conv2 = nn.Sequential(
nn.Conv2d(6, 16, 5),
nn.ReLU(), # (161010)
nn.MaxPool2d(2, 2) # output_size=(1655)
)
self.fc1 = nn.Sequential(
nn.Linear(16 * 5 * 5, 120),
nn.ReLU()
)
self.fc2 = nn.Sequential(
nn.Linear(120, 84),
nn.ReLU()
)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = self.conv1(x)
x = self.conv2(x)
x = x.view(x.size()[0], -1)
x = self.fc1(x)
x = self.fc2(x)
x = self.fc3(x)
return x
dummy_input = torch.rand(13, 1, 28, 28)
model = LeNet()
with SummaryWriter(comment='LeNet') as w:
w.add_graph(model, (dummy_input,))`
My environment is as follows:
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorboardX 2.4
tensorflow-estimator 2.5.0
torch 1.8.0
torchvision 0.9.0
The error is as follows:
Traceback (most recent call last):
File "D:/RoutineWork/python/Tensorboard/tensorboard.py", line 404, in
w.add_graph(model, (dummy_input,))
File "D:\Anaconda\envs\python37\lib\site-packages\tensorboardX\writer.py", line 944, in add_graph
from torch.utils.tensorboard.pytorch_graph import graph
File "D:\Anaconda\envs\python37\lib\site-packages\torch\utils\tensorboard_init.py", line 1, in
import tensorboard
File "D:\RoutineWork\python\Tensorboard\tensorboard.py", line 404, in
w.add_graph(model, (dummy_input,))
File "D:\Anaconda\envs\python37\lib\site-packages\tensorboardX\writer.py", line 944, in add_graph
from torch.utils.tensorboard._pytorch_graph import graph
File "D:\Anaconda\envs\python37\lib\site-packages\torch\utils\tensorboard_pytorch_graph.py", line 4, in
from tensorboard.compat.proto.config_pb2 import RunMetadata
ModuleNotFoundError: No module named 'tensorboard.compat'; 'tensorboard' is not a package
Process finished with exit code 1
Thank you!
Hi, can you try from tensorboard.compat.proto.config_pb2 import RunMetadata
and check if there is any error?
Did you resolve that? l have the same problem
@manjaro-git What is your environment?