[project] An implementation of Tensorboard for pytorch

Hi,

This is my recent project that saves tensorboard events without tensorflow.

The API is simple and intuitive. It currently saves scalar, image, audio, histogram and text data, and can be installed via PyPI.

Happy coding :slight_smile:

ps. the demo website is hosted on f1-micro instance. the server may be down if there are too many connections.

5 Likes

cool :slight_smile: note that it wasnt clear to me from the title of this thread that you were providing a tensorboard-like implementation for pytorch. I assumed you were asking where one could be found. Might be worth prefixing similar titles with [project], or An implementation of perhaps, in the future?

Title updated.

thanks!

Oh, it’s using the actual tensorflow tensorboard, to display pytorch output? Interesting :slight_smile:

Yes, the tensorboard events are define by the protocol buffers interface. While actual tensorflow write out events with c/c++? API, this package uses the python API to save events. Since protocol buffer is designed for data communication across languages, events with same protocol buffers definition (*.proto files) will be understandable by tensorflow’s tensorboard.

1 Like

@lanpa I was referring to your demo code for embedding in pytorch. I am trying to create embedding of images for CIFAR 10, and unfortunately I am unable to so, my code block:

    dataiter = iter(testloader)
    img, lbl = dataiter.next()


    _out = net(Variable(img))
    _out = _out.data
    _, predicted = torch.max(_out,1)

    print('GroundTruth: ', ' '.join('%9s' % classes[lbl[j]] for j in range(9)))
    print('Predicted: ', ' '.join('%9s' % classes[predicted[j]]for j in range(9)))

    #make embeddings

    print("inputs: ",img.shape)
    print("outputs: ",_out.shape)
    print("targets: ",lbl.shape)

    writer.add_embedding(_out, metadata=lbl, label_img=img)

When I check the tensorboard, there is no logging. Could you please help me?

Thanks in advance!

print("inputs: " ,img.shape) print("outputs: " ,_out.shape) print("targets: ",lbl.shape)
What are the output of this lines?

@lanpa the sizes are as below:

inputs: torch.Size([32, 3, 32, 32])
outputs: torch.Size([32, 10])
targets: torch.Size([32])

I got my code working, I think the issue was with the “_out.data”

    dataiter = iter(testloader)
    img, lbl = dataiter.next()
    _out = net(Variable(img))
    _, predicted = torch.max(_out,1)


    #GroundTruth
    print('GroundTruth: ', ' '.join('%9s' % classes[lbl[j]] for j in range(9)))
    #Predicted
    print('Predicted: ', ' '.join('%9s' % classes[predicted[j]]for j in range(9)))

    #Embeddings
    lbl = [classes[i] for i in lbl]
    writer.add_embedding(_out.data,metadata=lbl,label_img=img.data, global_step=epoch)

Thank you and do let me know if you have any more suggestions.