Using Tensorboard with Pytorch?

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

5 Likes

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

https://github.com/torrvision/crayon

3 Likes

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

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!

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

2 Likes

Tensorboard Logger is also good.

3 Likes

googled around and found this post,

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

5 Likes

this actually produces the pytorch graph in TB? amazing

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

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

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

Thanks

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.
3 Likes

Is there any update about integration of Pytorch directly with tensorboard ?
I looked at a interview of Soumith Chintala(creator of Pytorch) where he mentioned about such prospective integrations