Skip to content

TensorBoard

apapap edited this page Dec 16, 2018 · 8 revisions

How do I use TensorBoard in CoCalc?

Here's a step-by-step tutorial.

  1. Use TensorFlow as usual to train a model and put the output in a log directory. Create a new Terminal by clicking "+New", then Terminal. There are many ways to train a TensorBoard model and tons of tutorials.

    In order to get a quick canonical example running, do this:

~$ wget  https://raw.githubusercontent.com/tensorflow/tensorflow/r1.4/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py 
~$ python3 mnist_with_summaries.py 

(NOTE: You must have the project network access upgrade, or the wget above will hang.)

  1. Start TensorBoard in another Terminal, point it to the log file for the model you are training above, by typing
~$ tensorboard --logdir=/tmp/tensorflow/mnist
TensorBoard 0.4.0rc3 at http://project-4a5f0542-5873-4eed-a85c-a18c706e8bcd:6006 (Press CTRL+C to quit)
  1. Once TensorBoard starts, you can view your beautiful TensorBoard server running at
https://cocalc.com/4a5f0542-5873-4eed-a85c-a18c706e8bcd/server/6006/

where you have to replace 4a5f0542-5873-4eed-a85c-a18c706e8bcd by your project_id, which can see in your browser URL or in project settings. Don't forget to add the trailing slash!

Note that your TensorBoard viewer will only be available to collaborators on your project, not anybody in the world.

Be sure the version of TensorBoard you're using is compatible with the version of TensorFlow for your Jupyter kernel. For example, currently (December 2018) if the kernel for your notebook is Python 3 (Anaconda 5), you might need to specify a version of TensorBoard that is not the first one in your PATH:

~$ which tensorboard
/ext/bin/tensorboard
~$ anaconda5
(base) ~$ which tensorboard
/ext/anaconda5-py3/bin/tensorboard
(base) ~$ tensorboard --logdir=/home/user/tftest_logs/
TensorBoard 1.9.0 at http://project-3b9a2993-7ae8-46bd-a4e0-7c5fcc299d78:6006 (Press CTRL+C to quit)
Clone this wiki locally