Reputation: 155
Goal: I want to launch the tensorboard
dashboard and visualize the loss/metrics in the scalars tab from a generated tfevents
file there.
Setup:
In a conda
environment, with python=3.8.5
, with only these packages installed (I created a fresh environment to test the issue, initial code environment used python 3.9):
conda install -c anaconda jupyter
conda install ipykernel
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
conda install -c conda-forge tensorboard
pip install torch-tb-profiler
Outcome:
I have an already generated tfevents
file in the subfolder runs
. When I use vscode, the now vscode integrated tensorboard
is loading until timeout. First, I thought its an issue with vs code only...
But I tried to launch tensorboard via the integrated terminal (cmd prompt) with:
tensorboard --logdir=runs
or tensorboard --logdir="C:workspace\runs" --host localhost --port 6006
.
Whether in the interactive window in vscode or on http://localhost:6006/
, in all cases tensorboard
only opens with the orange header, with a blank page (see image below), loading eternally...
What am I doing wrong here? Its similar to this, but the solution there is not helpful. Thanks a lot!
EDIT: Thanks to @LzZ, it now magically works even with the above old environment when using the integrated terminal commands but the launch via the command palette still doesnt work in vscode
EDIT2: Somehow its back to NOT working again in no environment. Something must have unclogged everything yesterday. Now its back to not working...
EDIT3: Update: It now works when first calling tensorboard --logdir dir
in the integrated terminal. Only afterwards, the %load_ext tensorboard
and %tensorboard --logdir dir
also work in vscode
itself.
Upvotes: 1
Views: 9235
Reputation: 176
A bit of an old thread but ran into similar problem recently so VS code seems to still choke on tensorboard startup exceptions by hanging up which is not great!
A good way to troubleshoot and fix is to try and run tensorboard from the command line on a terminal in the same virtualenv as you're using in VS code. something like:
tensorboard --logdir somedir/
You will most likely run into some exception. In my case for example it was something like:
...
raise ValueError(
ValueError: Duplicate plugins for name projector
Which suggested some kind of duplicate installation scenario. This was quickly resolved when I realized I did indeed install a nightly version of tensorboard (released under the package name tb-nightly
) which apparently does not play nice with VS Code installing its own tensorboard! so I had to resolve by uninstalling and force reinstalling the regular tensorboard. a CLI such as the following would do:
pip uninstall tb-nightly
pip install -U --force-reinstall tensorboard
depending on the exact duplicate packages you might have installed details might be different, but more often than not this will be it.
Upvotes: 0
Reputation: 302
Try running pip uninstall torch-tb-profiler
to uninstall the plugin.
You should then be able to run tensorboard --logdir [name of log directory]
to get tensorboard running.
Upvotes: 6
Reputation: 23
I've also experienced such issue after installed the PyTorch Profiler Tensorboard plugin, which was recommended by python extension. What I've done to solve this issued is to re-install my conda environment and not to install the PyTorch Profiler Tensorboard plugin.
Upvotes: 1