5

Is it possible to use Tensorboard in Colaboratory. Running tensorboard locally shows rich information about model behaviour like loss etc..is it possible get same information when working with Colaboratory(https://colab.research.google.com).

MadTry
  • 71
  • 1
  • 2
  • I've been thinking the same ( plus I have some library I'm interested to that produce tensorboard debug ) however, an imperfect but simple workaround could be to download the log folder and run tensorboard locally. – Cesar Jan 23 '18 at 18:14
  • 4
    Possible duplicate of [Can I use Tensorboard with Google Colab?](https://stackoverflow.com/questions/47818822/can-i-use-tensorboard-with-google-colab) – Bob Smith Jan 23 '18 at 20:08

2 Answers2

4

You have two options you can use one of the python programs that allows you to tunnel to the machine instance that is hosting your python app. I tested this one: https://github.com/taomanwai/tensorboardcolab

!pip install -U tensorboardcolab
from tensorboardcolab import *
import shutil

#clean out the directory
shutil.rmtree('./Graph', ignore_errors=True)
os.mkdir('./Graph')

tf.reset_default_graph()

#will start the tunneling and will print out a link:
tbc=TensorBoardColab()

#**here you construct your model**

sess = tf.Session()
output = sess.run(....)
sess.close()

train_writer = tbc.get_writer();
train_writer.add_graph(sess.graph)

train_writer.flush();
tbc.close()

The other solution is to zip all the files and download them to your machine.

piotr szybicki
  • 1,532
  • 1
  • 11
  • 12
1

Now you can use Tensorboard in Colab without ngrok and additional packages:

import os
logs_base_dir = "tb_runs"
os.makedirs(logs_base_dir, exist_ok=True)
%load_ext tensorboard
%tensorboard --logdir {logs_base_dir}
# Now Tensorboard interface appear in this cell output

Official example: https://www.tensorflow.org/tensorboard/get_started

Anton Ganichev
  • 2,184
  • 1
  • 18
  • 17