Tensorboardx: tensorboard does not show graph

Created on 6 Feb 2020  路  9Comments  路  Source: lanpa/tensorboardX

Describe the bug
I use a simple example to add a linear model by add_graph(), generate "runs/Feb06_11-31-24_casperMac.localNet1/events.out.tfevents.1580959884.casperMac.local" file. but after I run the command "tensorboard --logdir=runs". Then I can not see the graph at http://casperMac.local:6006

Minimal runnable code to reproduce the behavior

# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from tensorboardX import SummaryWriter


class Net1(nn.Module):
    def __init__(self):
        super(Net1, self).__init__()
        self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
        self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
        self.conv2_drop = nn.Dropout2d()
        self.fc1 = nn.Linear(320, 50)
        self.fc2 = nn.Linear(50, 10)
        self.bn = nn.BatchNorm2d(20)

    def forward(self, x):
        x = F.max_pool2d(self.conv1(x), 2)
        x = F.relu(x) + F.relu(-x)
        x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2))
        x = self.bn(x)
        x = x.view(-1, 320)
        x = F.relu(self.fc1(x))
        x = F.dropout(x, training=self.training)
        x = self.fc2(x)
        x = F.softmax(x, dim=1)
        return x


dummy_input = torch.rand(13, 1, 28, 28)

model = Net1()
with SummaryWriter(comment='Net1') as w:
    w.add_graph(model, (dummy_input, ))

Screenshots
error

Environment
tensorboard 1.13.1
tensorboardX 2.0
tensorflow 1.13.2
tensorflow-estimator 1.13.0
torch 1.4.0
torchvision 0.5.0

Python environment
Python 3.6.10 and conda 4.8.1

Most helpful comment

The function scopeName return None in pytorch. It is likely pytorch remove the scopeName in pytorch==1.4

All 9 comments

I met the same trouble, and then I used the earlier version of pytorch and torchvision.
torch 1.3.0
torchvision 0.4.1
And I can see the graph in chrome now.
hope this helps

I am having the same problem,
with python 3.6.10, torch 1.4.0, torchvision 0.5.0, tensorboard 2.1.0, tensorboardX 2.0

The function scopeName return None in pytorch. It is likely pytorch remove the scopeName in pytorch==1.4

yes,with torch 1.3.0, torchvision 0.4.0,i see the graph

The function scopeName return None in pytorch. It is likely pytorch remove the scopeName in pytorch==1.4

Why did they delete it?

I met the same problem, with torch 1.5.0, torchvision 0.6.0.
I tried torch 1.3.0, torchvision 0.4.0 and it worked in Edge

it works for torch 1.3.0 and torchvision 0.4.1.

Thank you all guys, I met the same situation,with torch 1.2.0 tensorboardX2.1 and I replaced the torch 1.2.0 with torch 1.3.0. It works!

Hi, all. Since tensorboardX v2.1, the add_graph function is actually calling the graph generating function in pytorch. Please update to the latest pytorch and file an issue at pytorch/pytorch. Btw, the old add_graph() has been renamed to add_graph_deprecated().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hrtang picture hrtang  路  4Comments

blueardour picture blueardour  路  6Comments

shuxiaobo picture shuxiaobo  路  7Comments

aymenmir94 picture aymenmir94  路  7Comments

yaodi833 picture yaodi833  路  6Comments