Using Tensorboard with Pytorch?


#1

Is there a way to use Tensorboard with Pytorch and visualize your model’s parameters during training?


(Indrayana Rustandi) #2

Haven’t used it myself, but this might do what you want:

https://github.com/torrvision/crayon


(Miguel Varela Ramos) #3

^ this works perfectly. I use it with all of my models


(dl4daniel) #4

Hi @miguelvr I am also interesting in using tensorboard to pytorch. However, I am new to both, could you share some of your examples on using tensorboard with pytorch? Thanks a lot!


(Miguel Varela Ramos) #5

First just follow the instructions on github on how to run the crayon server.

Then, just initialize your model regularly and add the pycrayon attributes to it:

self.cc = CrayonClient(hostname=“localhost”)

# Create a new experiment
self.summary = self.cc.create_experiment(type(self).__name__)

Then, when you compute you training loss, for example, you can do:

model.summary.add_scalar_value("train_loss", loss)

You can do the same process to any scalar value you are interested in monitoring. Crayon currently only supports scalars and histograms.

To see what’s going on on TensorBoard, just type in your browser: http://localhost:8888


(Kiran Vaidhya) #6

Tensorboard Logger is also good.


#7

googled around and found this post,

Another new package looks good to use as well, especially for model parameter visualization.


(Miguel Varela Ramos) #8

this actually produces the pytorch graph in TB? amazing


(Xiaoyu Ma) #9

You can save log to a file, and read it from a simple graphic tools like matplot, this is a simple way.


#10

But it seems not working well for complex models like ResNet.


(Vijay Dubey) #11

Hey @maxiaoyuzdz
Can you please elaborate more on that or give some examples regarding that?

Thanks


#12

I’m also interested in this topic.
There is a nice sample of using TensorBoard without third party libraries. Is there any good features if we use above libraries?

  • Update
    I’m sorry. They use their class. But it looks very simple and reusable.