Code Monkey home page Code Monkey logo

tensorboardx's Introduction

tensorboardX

PyPI version Documentation Status Coverage Status

Write TensorBoard events with simple function call.

The current release (v2.5) is tested on anaconda3, with PyTorch 1.11.0 / torchvision 0.12 / tensorboard 2.9.0.

  • Support scalar, image, figure, histogram, audio, text, graph, onnx_graph, embedding, pr_curve, mesh, hyper-parameters and video summaries.

  • FAQ

Install

pip install tensorboardX

or build from source:

pip install 'git+https://github.com/lanpa/tensorboardX'

You can optionally install crc32c to speed up.

pip install crc32c

Starting from tensorboardX 2.1, You need to install soundfile for the add_audio() function (200x speedup).

pip install soundfile

Example

# demo.py

import torch
import torchvision.utils as vutils
import numpy as np
import torchvision.models as models
from torchvision import datasets
from tensorboardX import SummaryWriter

resnet18 = models.resnet18(False)
writer = SummaryWriter()
sample_rate = 44100
freqs = [262, 294, 330, 349, 392, 440, 440, 440, 440, 440, 440]

for n_iter in range(100):

    dummy_s1 = torch.rand(1)
    dummy_s2 = torch.rand(1)
    # data grouping by `slash`
    writer.add_scalar('data/scalar1', dummy_s1[0], n_iter)
    writer.add_scalar('data/scalar2', dummy_s2[0], n_iter)

    writer.add_scalars('data/scalar_group', {'xsinx': n_iter * np.sin(n_iter),
                                             'xcosx': n_iter * np.cos(n_iter),
                                             'arctanx': np.arctan(n_iter)}, n_iter)

    dummy_img = torch.rand(32, 3, 64, 64)  # output from network
    if n_iter % 10 == 0:
        x = vutils.make_grid(dummy_img, normalize=True, scale_each=True)
        writer.add_image('Image', x, n_iter)

        dummy_audio = torch.zeros(sample_rate * 2)
        for i in range(x.size(0)):
            # amplitude of sound should in [-1, 1]
            dummy_audio[i] = np.cos(freqs[n_iter // 10] * np.pi * float(i) / float(sample_rate))
        writer.add_audio('myAudio', dummy_audio, n_iter, sample_rate=sample_rate)

        writer.add_text('Text', 'text logged at step:' + str(n_iter), n_iter)

        for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param.clone().cpu().data.numpy(), n_iter)

        # needs tensorboard 0.4RC or later
        writer.add_pr_curve('xoxo', np.random.randint(2, size=100), np.random.rand(100), n_iter)

dataset = datasets.MNIST('mnist', train=False, download=True)
images = dataset.test_data[:100].float()
label = dataset.test_labels[:100]

features = images.view(100, 784)
writer.add_embedding(features, metadata=label, label_img=images.unsqueeze(1))

# export scalar data to JSON for external processing
writer.export_scalars_to_json("./all_scalars.json")
writer.close()

Screenshots

Using TensorboardX with Comet

TensorboardX now supports logging directly to Comet. Comet is a free cloud based solution that allows you to automatically track, compare and explain your experiments. It adds a lot of functionality on top of tensorboard such as dataset management, diffing experiments, seeing the code that generated the results and more.

This works out of the box and just require an additional line of code. See a full code example in this Colab Notebook

Tweaks

To add more ticks for the slider (show more image history), check #44 or tensorflow/tensorboard#1138

Reference

tensorboardx's People

Contributors

ammaddd avatar andres-fr avatar anotherbugmaster avatar atcold avatar bnsh avatar cosmicbboy avatar dependabot[bot] avatar dhroth avatar dn6 avatar dtmoodie avatar exyi avatar hsluoyz avatar lanpa avatar levirve avatar lucabergamini avatar mdfirman avatar ml7 avatar nataliakliushkina avatar nelson-liu avatar orionr avatar ppwwyyxx avatar prafullasd avatar sloretz avatar taketwo avatar teffland avatar thibzr avatar tjni avatar velikodniy avatar vojtamolda avatar willprice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorboardx's Issues

Tensorboard Embedding wrong images/labels

It's me again :)
I'm running some embedding visualization on the MNIST dataset.

My metadata.tsv

0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
8
8
8
8
8
8
8
8
9
9
9
9
9
9
9
9

My sprite.png
sprite

How can this possibly happen :) ?
wrong_label

I've checked the tensorboard doc and everything seems disposed as requested..

Move x2num preprocessings into the summary.py

Now all the x2num preprocessings are in writer.py, like:

def add_scalar(self, tag, scalar_value, global_step=None):
        """Add scalar data to summary.
        Args:
            tag (string): Data identifier
            scalar_value (float): Value to save
            global_step (int): Global step value to record
        """
        scalar_value = makenp(scalar_value)
        assert(scalar_value.squeeze().ndim==0), 'input of add_scalar should be 0D'
        self.file_writer.add_summary(scalar(tag, scalar_value), global_step)

Why not put scalar_value = makenp(scalar_value) in scalar function.

The reason I'm proposing this, is I'm using FileWriter, and I collect the summaries during forwarding the network. (Like the pipeline in tensorflow) So I will call the scalar histogram etc functions by myself. (The reason I don't use SummaryWriter is I don't want the SummaryWriter to be exposed to the model itself.)

Now, to call scalar or histogram I have to convert to numpy first, which is ok but not necessary because you can move all the x2num to summary.py.

What do you think.

Histogram exploded the memory.

Hi,

thank you for providing this library. Some problems that I came across today.

If I try to make a histogram out of the weights of some module, it is possible to explode the number of bins and consume an extremely large amount of memory. The problem due to this line https://github.com/lanpa/tensorboard-pytorch/blob/master/tensorboard/summary.py#L118. The argument bins is never used, and as a results auto is used in np.histogram, which would produce bin that is as large as 66618527586 (see attachment for an example of a bad weight matrix)

I am not sure what the preconditions for the HistogramProto are, but using the bins argument and passing it into make_histogram would solve the problem.

x.npy.zip

Black Images in embedding

Related to #12 , some configuration still leads to black images for the first column of the sprite. It happens with sprites completely full (i.e. the number of images is a perfect square), but only with some configurations (i.e 49 does but 100 does not). The TB implementation seems a really mess IMHO, so its not excluded it is their fault somehow.

I suggest to leave this open for other users.

slider bar's values jumps when moving the bar's knob

I used add_image() to record some visualization results at each step/epoch, during training the image at each step/epoch is displayed well, but after the training is done, when i draw the knob left and right, it doesn't increase or decrease incrementally by step 1, instead step numbers can just goes like 1->2->4->6->12 ..., which is annoying, my college also has the same issue. I guess it is a front-end issue, can anyone post a fix? Thanks.

TypeError: Parameter to MergeFrom() must be instance of same class: expected Summary got Summary. for field Event.summary

Hi,

I'm using pytorch on Windows10 following the tutorial in 'https://zhuanlan.zhihu.com/p/26871672'

When i try tensorboardX out, i keep getting the following error:
TypeError: Parameter to MergeFrom() must be instance of same class: expected Summary got Summary. for field Event.summary

I also tested in Ubuntu, no error occurred. So I guess it maybe caused by windows platform (or not ╮(╯▽╰)╭). Anyway, could you have a look on this issue and hopely provide a solution? After all, many guys are still bonded with Windows.

My pip freeze is listed below:

pip freeze
alabaster==0.7.9
anaconda-clean==1.0
anaconda-client==1.5.1
anaconda-navigator==1.3.1
appdirs==1.4.3
apptools==4.4.0
argcomplete==1.0.0
astroid==1.4.7
astropy==2.0.2
autopep8==1.3.2
Babel==2.3.4
backports.shutil-get-terminal-size==1.0.0
beautifulsoup4==4.5.1
bitarray==0.8.1
blaze==0.10.1
bleach==1.5.0
bokeh==0.12.2
boto==2.42.0
Bottleneck==1.2.1
cffi==1.10.0
chardet==3.0.2
chest==0.2.3
click==6.6
cloudpickle==0.2.1
clyent==1.2.2
colorama==0.3.7
comtypes==1.1.2
conda==4.3.25
conda-build==2.0.2
configobj==5.0.6
contextlib2==0.5.3
cryptography==1.5
cycler==0.10.0
Cython==0.24.1
cytoolz==0.8.0
dask==0.15.2
datashape==0.5.2
decorator==4.0.10
dill==0.2.5
docutils==0.12
dynd===c328ab7
envisage==4.5.1
et-xmlfile==1.0.1
fastcache==1.0.2
filelock==2.0.6
Flask==0.11.1
Flask-Cors==2.1.2
gevent==1.1.2
greenlet==0.4.10
h5py==2.7.0
HeapDict==1.0.0
html5lib==0.9999999
idna==2.1
imagesize==0.7.1
ipykernel==4.5.0
ipython==5.1.0
ipython-genutils==0.1.0
ipywidgets==5.2.2
itsdangerous==0.24
jdcal==1.2
jedi==0.9.0
Jinja2==2.8
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.4.0
jupyter-console==5.0.0
jupyter-core==4.2.0
lazy-object-proxy==1.2.1
llvmlite==0.20.0
locket==0.2.0
lxml==3.6.4
Markdown==2.6.9
MarkupSafe==0.23
matplotlib==2.0.2
menuinst==1.4.1
mistune==0.7.3
mpmath==0.19
multipledispatch==0.4.8
nb-anacondacloud==1.2.0
nb-conda==2.0.0
nb-conda-kernels==2.0.0
nbconvert==4.2.0
nbformat==4.1.0
nbpresent==3.0.2
networkx==1.11
nltk==3.2.1
nose==1.3.7
notebook==4.2.3
numba==0.35.0
numexpr==2.6.2
numpy==1.13.1
numpydoc==0.6.0
odo==0.5.0
opencv-python==3.3.0+contrib
openpyxl==2.3.2
packaging==16.8
pandas==0.20.3
partd==0.3.6
path.py==0.0.0
pathlib2==2.1.0
patsy==0.4.1
pep8==1.7.0
pickleshare==0.7.4
Pillow==3.3.1
pkginfo==1.3.2
ply==3.9
prompt-toolkit==1.0.3
protobuf==3.4.0
psutil==4.3.1
py==1.4.31
pyasn1==0.1.9
pycodestyle==2.3.1
pycosat==0.6.1
pycparser==2.14
pycrypto==2.6.1
pycurl==7.43.0
pyface==5.1.0
pyflakes==1.3.0
Pygments==2.1.3
pylint==1.5.4
pyOpenSSL==16.2.0
pyparsing==2.2.0
pyreadline==2.1
pytest==2.9.2
python-dateutil==2.6.0
pytz==2017.2
PyWavelets==0.5.2
pywin32==220
PyYAML==3.12
pyzmq==15.4.0
QtAwesome==0.4.4
qtconsole==4.2.1
QtPy==1.1.2
requests==2.13.0
rope-py3k==0.9.4.post1
ruamel-yaml===-VERSION
scikit-image==0.13.0
scikit-learn==0.19.0
scipy==0.19.1
seaborn==0.7.1
selenium==3.4.1
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
snowballstemmer==1.2.1
sockjs-tornado==1.0.3
Sphinx==1.3.1
spyder==3.1.4
SQLAlchemy==1.0.13
statsmodels==0.8.0
svgwrite==1.1.6
sympy==1.0
tables==3.2.2
tensorboardX==0.6.9
tensorflow==1.3.0
tensorflow-tensorboard==0.1.6
toolz==0.8.0
torch==0.2.1+a4fc05a
torchvision==0.1.9
tornado==4.4.1
traitlets==4.3.0
unicodecsv==0.14.1
update==0.4.4
wcwidth==0.1.7
Werkzeug==0.12.2
widgetsnbextension==1.2.6
win-unicode-console==0.5
wrapt==1.10.6
xgboost==0.6
xlrd==1.0.0
XlsxWriter==0.9.3
xlwings==0.10.0
xlwt==1.1.2

add_histgram : TypeError

The code is add_histogram(name,data, niter) as examples.
But it can not work.
The error msg is
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/writer.py", line 305, in add_histogram
self.file_writer.add_summary(histogram(tag, values, bins), global_step)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 113, in histogram
hist = make_histogram(values.astype(float), bins)
File "/opt/pytorch/lib/python3.5/site-packages/tensorboardX/summary.py", line 131, in make_histogram
bucket=counts)
TypeError: 0 has type numpy.int64, but expected one of: int, long, float

Graph Scope

Hi,
I'm a Pytorch beginner (previously working on th and tf) using your tensorboard-pytorch bridge to get some info during neural net training. It works like a charm for everything i've needed since now :). However i'm having some troubles with the graph visualization for some ConvNet and i've a few questions:

  • Is it possible to define scope for module? (i.e. if I'have a nested module can i give it a name to obtain a compress visualization of everything inside it?) ;
  • using the torch.cat() method i get some strange behaviours related to the order of the elements in the list of the first argument of cat() (see attached images, where the second one is correct for the code reported) .

Btw great work :)

def forward(self,i):
        # i stand as the input
        # conv_j is a module
        x = self.conv_0(i)
        x = self.conv_1(x)
        y = self.conv_r1(i)
        z = torch.cat((y,x),1)
        z = z.view(len(z),-1)
        z = self.fc1(z)
        z = F.relu(z)
        z = self.fc2(z)
        z = F.log_softmax(z)
        return z

cat_2
cat_1

Protobuf failure

I'm occasionally getting an error of the following form:

 [libprotobuf FATAL google/protobuf/wire_format.cc:830] CHECK failed: (output->ByteCount()) == (expected_endpoint): : Protocol message serialized to a size different from what was originally expected.  Perhaps it was modified by another thread during serialization?
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: (output->ByteCount()) == (expected_endpoint): : Protocol message serialized to a size different from what was originally expected.  Perhaps it was modified by another thread during serialization?

Is this some underlying tensorboard issue, or due tensorboard-pytorch?

wrong histograms

Hi, I am having problems plotting histograms. I think there is a very good chance that it is not because of a bug in tensorboard-pytorch, but I'm not sure what I could be doing wrong, and I'm not sure where to ask, so if someone could help I would appreciate it.

I am trying to plot histograms of the gradients like this:

loss.backward()
for n, p in filter(lambda np: np[1].grad is not None, spectral_model.named_parameters()):
    print(n, p.grad.data.min(), p.grad.data.max())
    summary_writer.add_histogram(n, p.grad.data.cpu().numpy(), global_step=step)

The mins and maxes show that the values are all between -.15 and .15 (and in fact most values are much closer to zero than that). But the histograms seem to show that all the values are located at one extremely high value, like 3.01e+18:

image

why do you use clone in histogram examples?

From the readme,

for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param.clone().cpu().data.numpy(), n_iter)

Could we instead use the following simpler version?

for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param.data.cpu().numpy(), n_iter)

(Or we could put the .cpu() before the .data probably -- I don't think this matters.)

Cannot import SummaryWriter

When I try to do:

from tensorboard import SummaryWriter I get an error saying ImportError: cannot import name 'SummaryWriter'
After looking inside conda packages I found out that in the folder ~/anaconda3/lib/python3.6/site-packages/tensorboard/ there is no SummaryWriter, instead, I found it in the folder [...]/tensorboardX. Thus, I changed to from tensorboardX import SummaryWriter getting a new error when logging a scalar value that says TypeError: Parameter to MergeFrom() must be instance of same class: expected Summary got Summary. for field Event.summary

Any ideas of why is this happening?

Thanks in advance,
Manu.

'SummaryWriter' object has no attribute 'add_scalars'

Hi,

I'm using version 0.6, and it works fine when I use writer.add_scalar. However, using writer.add_scalars returns the following error:

writer.add_scalars('loss',{'train_loss':loss.data[0],

AttributeError: 'SummaryWriter' object has no attribute 'add_scalars'

Is there any explanation why this fails?

Why is the audio sample rate fixed at 44100?

From glancing at the code, the audio function in summary.py seems to take a sample rate argument, so it looks like it would be trivial for the add_audio method of SummaryWriter to take an optional sample rate argument and pass it along to audio. Is there some complicating factor here?

Sdist to PyPI

Hi,

Is it possible to upload the latest sdist to python such that there is a tar.gz and whl like in Keras? It would be nice to have a non-binary import from PyPI.

Link to keras example: https://pypi.python.org/pypi/Keras

Thanks!

log batches of embeddings

Is there a way to log batches of embeddings then interact with all of the batches together in the projector?

I'm currently logging batches with the following code:

writer.add_embedding(embedding_batch, metadata=label_batch,
                   label_img=train_batch, global_step=current_epoch) 

When I check the embeddings in the projector I have 10 (batch size * dim) tensors and I can only look at one batch at a time. they are named default:0000 - default:0010. Any way to get these all on the same graph?

pip install failed

Env

anaconda2
ubuntu 14.04

error log:

with open('HISTORY.rst') as history_file:
IOError: [Errno 2] No such file or directory: 'HISTORY.rst'

The pip repo is not updated yet. The version is 0.4

The add_graph does not work

Hi! my code is listed below; but the procedure does not work, it stops there all time. How can i get over it? thx!

create model

model = dn.DenseNet3(args.layers, 10, args.growth, reduction=args.reduce,
                     bottleneck=args.bottleneck, dropRate=args.droprate, inputdim=args.inputdim)

res = model(torch.autograd.Variable(torch.Tensor(1, 3, 32, 32), requires_grad=False))
writer = SummaryWriter("runs/%s" % (args.name))
writer.add_graph(model, res)
writer.close()

Strange histograms

Hi, this is really nice project. I started to use this library because I wanted to see histograms of my trainable parameters.

Although I run demo.py, the histograms looks strange. Is it expected behaviors?

  • tensorboardX: 0.8
  • python 3.6.1 (Anaconda)
  • tensorflow: 1.4.0
  • tensorflow-tensorboard: 0.4.0rc3
  • PyTorch: 0.3.0.post4
$ python demo.py
$ tensorboard --logdir runs

screen shot 2017-12-08 at 3 53 50 pm

Text output not working (no graph is present)

When I'm trying to log text with tensorboard using this code

from tensorboardX import SummaryWriter
w = SummaryWriter("runs/test")
w.add_scalar("s", 1)
w.add_text("t", "text")

I get the following error:

ERROR:tensorflow:Attempting to process TensorSummary output, but no graph is present, so processing is impossible. All TensorSummary output will be ignored.
Adding scalars for example works.

In my tensorboard no "Text" menu item is displayed.

Logging scalars works fine.

The following versions are installed:
tensorboardX (0.8)
tensorflow (1.3.0)
tensorflow-tensorboard (0.1.7)
torch (0.2.0.post3)

package name conflict

there's a conflict with package names at loading time when you install the standalone version of tensorboard from: https://github.com/dmlc/tensorboard

The use case is to not have to install tensorflow, since that's whole point of using pytorch. Any workaround for this? I'd would be more intuitive to rename the module to tensorboard-pytorch

Please add a variant of add_image which accepts PNG as file

Hi! I am plotting some custom stuff with pyplot during training and want to add these plots to TensorBoard as images. Since TensorBoard uses PNG, it would be really convenient to have add_image which accepts a file (or BytesIO) as input. It would be mush easier to save a plot to memory in PNG format and skip all that tensor juggling.

add_embedding TF dependecy

Hello again,

Since add_embedding relies on TF,

import tensorflow as tf

on line 58, I get a constant stream of tensorflow GPU logging events during training about the creation of the gpu device every time the function is called. Even if if does not compromise the functionality, it makes the output log a real mess to read.

Are you planning to strip the dependency (as have already been done with the SummaryWriter object) ?

Tags are interpreted as independent runs

This code

 writer = SummaryWriter(log_dir="runs/first_run") 
 writer.add_scalars('loss/pi', {"policy": pi_loss.data[0], 
                                "value": V_pi_loss.data[0], 
                                "entropy": pi_entropy.data[0]}, i_episode) 

yields in tensorboard page

screen shot 2017-10-28 at 18 59 03

I guess, this is not the way the Tensorboard is supposed to recognise tags.

Also, if I add, for example, 30 different summaries (including a bunch of histograms and scalars), CPU consumption increases significantly (up to the whole available cpu time). Tensorboard becomes almost irresponsible.
I guess such a behaviour may also be due to very many tags being interpreted by tensorboard as independent runs.

tensorboard-pytorch==0.8 was installed with pip
tensorboard is of 0.1.8 (more older versions of tensorboard are also susceptible to the same issue).

Can't add graph with pytorch v0.2

I tried to run this snippet:

import torch
import torch.nn as nn
from torch.autograd import Variable
from datetime import datetime
from tensorboard import SummaryWriter


x = Variable(torch.rand(10, 10), requires_grad=True)

model = nn.Linear(10, 10)

h = model(x)

writer = SummaryWriter('runs/'+datetime.now().strftime('%B%d  %H:%M:%S'))

writer.add_graph(model, h)
writer.close()

but I get this error message:

Traceback (most recent call last):
  File "/Users/Miguel/Documents/Unbabel/pytorch-tools/tests/test_tensorboard.py", line 16, in <module>
    writer.add_graph(model, h)
  File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/writer.py", line 259, in add_graph
    self.file_writer.add_graph(graph(model, lastVar))
  File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 39, in graph
    make_list_of_nodes(lastVar.grad_fn)
  File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 23, in make_list_of_nodes
    inputs.append(make_name(next_fn))
  File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 12, in make_name
    return id2name[id(obj.variable)]+'_'+str(id(obj.variable))
KeyError: 4654832816

Incorporate `add_embedding` into SummaryWriter

Some advantages to implement it in SummaryWriter:

  • More general and uniform APIs to use.
  • Manage all the embeddings under one dir: runs/XXX (currently the embedding must be written into separate directories.
  • Don't have to run different tensorboard instances for embedding visualization and other summary info

And in your README.txt, the add_embedding is under SummaryWriter part.

If the original tensorboard don't have such mechanism, we can wrap the SummaryWriter and add_embedding into brand new unified APIs.

Support nested tags

From the tensorflow docs, it seems like I should be able to organize data into nested groups. However, it looks like / is included in the _INVALID_TAG_CHARACTERS regex so it's stripped.

The comment mentions using name scopes, but I can't figure out what that's referring to or how to use those instead.

Nothing being shown pytorch3.0

I am trying to run the demo.py code, but it seems no data is being sent to server.
Also, I can't see any thrown exceptions, so I am not sure where to begin debugging.
I am running pytorch3.0 and tensorboard 0.4.0rc3.

Any ideas?

tensorboard-pytorch installation: "No module named tensorflow"

Hello there,

I am new to tensorboard-pytorch and submitting issue on GitHub, so if you think asking question instead of filing bugs here is not a good idea, I will ask this somewhere else (please tell me where) and delete this issue.

I followed the walkthrough on this repo's README and successfully run the tensorboardX. Everything I intend to record has been saved, but there is only one issue when I run tensorboard in terminal. When I run tensorboard --logdir=logger, 'No module named tensorflow' prompted from tensorboard/main.py. I have to activate my tensorflow environment and run the command to visualize recorded file.

I have run two commands pip install tensorboardX and pip install tensorflow-tensorboard successfully by the way. I used python 2.7 virtualenv to integrate everything about pytorch together.

Histograms does not work properly

Hi, thanks for your great work.

When I add network's parameters to histogram via:

for name, param in resnet18.named_parameters():
       writer.add_histogram(name, param.clone().cpu().data.numpy(), n_iter)

The histograms showed in tensorboard are always a peak triangles. I have tried the mnist and vae examples from https://github.com/pytorch/examples. Histograms are always triangles.
image

Behavior of `global_step=None`

This is probably a stupid question: I don't understand the behavior when global_step=None. I'd expect the plot's x-axis to correspond to wallclock time, but in reality it squeezes the curve to a single dot.
Both this repo and the official TB repo say global_step is optional. Under what situation do I actually set it to None?

[Minor] SummaryWriter.add_histogram on usage section of README does not properly work

One line at usage section of README does not properly work on python3.6

       for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param, n_iter)

This code produces weird looking spike like histogram

kazam_screenshot_00000

In my case, I should specify bins parameter to get a correct result.

       for name, param in resnet18.named_parameters():
            writer.add_histogram(name, param, n_iter, bins='auto')

BTW, thank you for your great work!

'SummaryWriter' object has no attribute 'add_pr_curve'

I first installed tensorboardX using

pip install tensorboardX

Received the error message

AttributeError: 'SummaryWriter' object has no attribute 'add_pr_curve'

Removed tensorboardX

pip unistall tensorboardX

Built from source

pip install git+https://github.com/lanpa/tensorboard-pytorch

Received the same error message.
Checked writer.py in my installation and found that add_pr_curve is indeed missing from SummaryWriter.

Any insight regarding this issue would be appreciated.

System:

TensorFlow 1.4.0 (CPU version)
TensorFlow-TensorBoard 0.4.0rc3
PyTorch 0.3
Anaconda Python 3.6
Linux: Ubuntu 17.10 with kernel 4.13.0

Fix support for Markdown tables

Tensorboard supports displaying of Markdown (including tables). However, passing a markdown table into tensorboard-pytorch seems to mangle the table.

Graph visualization clarification

I generated a graph are there a few operations that are unclear to me since I did not explicitly call them in PyTorch.

TransposeBackward - is this included with all nn.Linear operations?
AddmmBackward - is the short for add, matrix multiply for nn.Linear operations?

Below is a snippet of my graph.
screen shot 2017-12-24 at 7 54 43 pm

Packaging issues

I am currently working on packaging tensorboardX for https://conda-forge.org/ and for the AUR.
For making a package, we generally need either an sdist of a released version or a tagged release on Github (or even better: both).
This shouldn't be much work and doesn't break anything:
Instead of

python setup.py build wheel
twine upload dist/*

you'd just need to run

python setup.py build sdist wheel
twine upload dist/*

I also have two quick questions:

  • Am I correct that the official name of this project is now "tensorbaordX" and the name "tensorboard-pytorch" will be 100% replaced by it? If yes, would you mind also renaming your repository and the documentation page so it's less confusing for new users?
  • In setup.py, you specify the license as MIT, but there is no explicit license file. Package repositories like having a very clear licensing situation, so it would help if you'd add a LICENSE with the MIT license text to your repository.

Thanks a lot for your work on making tensorboard available from pytorch, @lanpa and contributors! I am impressed with how easy it was to integrate into my pytorch code.

[Feature Request] optionally remove an experiment

Hey, thanks for the great work!

It would be even better if there is an option to optionally remove a particular experiment like what we have in Crayon.

from pycrayon import CrayonClient

# Connect to the server
cc = CrayonClient(hostname="server_machine_address")
cc.remove_experiment(xp_name) # remove the 'xp_name' experiment

Thanks!

How to rebuild on top of latest tensorboard version?

Hi, recently Tensorboard added the ability to customize images per page (tensorflow/tensorboard@0981512). This is a very useful feature for me but I use PyTorch and hence tensorboardX.

I'd like to update tensorboardX to have this feature. I expect I'd have to build from source to do this as pip shows me as having the latest tensorboardX version (0.8). But reading through your source code, I can't find where / what I would need to change to update the underlying tensorboard web server. Any advice would be appreciated. Thanks for maintaining a great project.

ImportError: cannot import name 'SummaryWriter'

I do not use anaconda, I install tensorboard-pytorch and tensorflow py pip in the virtual enviroment.

I tried, from tensorboard import SummaryWriter, it complains as the title. However, I find the SummaryWriter is in the writer.py in tensorboard, so I have to use from tensorboard.writer import SummaryWriter. Where am I wrong?

Not compatible with tensorflow 1.3?

After I installed tensorflow 1.3 ,tensorboard can be used in terminal
But after I installed tensorboard-pytorch, it can not work:

Traceback (most recent call last):
  File "/usr/local/bin/tensorboard", line 7, in <module>
    from tensorboard.main import main
ImportError: No module named 'tensorboard.main'

add_embedding expected hierarchy

Hello again
I'm currently experimenting with the embeddings' visualization, and i'm having some troubles with the expected folder hierarchy. As far as I have understand, the add_embedding function does not have any timestep parameters (although there is one in the function called with value None), so it does not provide a time distributed visualization. The current hierarchy of my loggings is the following:

-project
--runs
---August14_11:24:12
----event.out
---August14_11:28:12
----event.out

i.e. every running gets his own directory with the SummaryWriter events (file event.out), and i can run everything using tensorboard from the project dir (tensorboard --logdir runs).

If I use add_embedding for one of the experiments with the following notation

add_embedding(torch.FloatTensor(out_numpy),save_path='runs/August14_11:28:12',metadata=[k.data.numpy()[0]  for k in label_batch ])

I get one warning each time complaining about the fact the dir already exists, and the embedding log file get overwritten each time, so I can see only the last one written.

However if I log to a subdir with the following notation

add_embedding(torch.FloatTensor(out_numpy),save_path='runs/August14_11:28:12/emb{}'.format(unique_id),metadata=[k.data.numpy()[0]  for k in label_batch ])

I can't see any embedding in the visualization's page, and i have to run tensorboard directly in the embedding log directory (e.g. tensorboard --logdir runs/August14_11:28:12/emb0), which is a bit of a pain if I log every 25 batch.

Any solutions of best practices?

Comparison with other tensorboard libs

Hi, sorry for the non-coding question. What's the difference between this library and the other older ones like Crayon and tensorboard_logger? Crayon looks a bit heavy-weight because it requires docker. tensorboard_logger has not been maintained for 9 months. Other than these, are there any functional differences?

Detected out of order event.step when adding text after scalars with global_step

When logging text after logging scalar values with the global_step parameter set, tensorboard gives a warning (see below).

This is a MWE:

from tensorboard import SummaryWriter
writer = SummaryWriter('runs/test')
writer.add_text("T", "42")
writer.add_scalar("S", 0, 0)
writer.add_scalar("S", 0, 1)
writer.add_scalar("S", 0, 2)
writer.add_text("T", "42")

WARNING:tensorflow:Detected out of order event.step likely caused by a TensorFlow restart. Purging expired events from Tensorboard display between the previous step: 2 (timestamp: 1501673169.092804) and current step: 0 (timestamp: 1501673169.0928545). Removing 3 scalars, 0 histograms, 0 compressed histograms, 0 images, and 0 audio.

As can be seen from the warning log, this actually removes logged data.

Is this a problem just on my side or tensorboard related or from the pytorch wrapper?

Multiple Embeddings in One Experiment

For add_scalar, add_histogram, add_image, etc., they accept a tag argument to indicate different tensors. However, add_embedding does not have such an argument. Is it possible to add this argument so as to monitor multiple embeddings in one experiment?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.