Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use TensorBoard with Google Colab?

Is there any way to use TensorBoard when training a TensorFlow model on Google Colab?

like image 401
ociule Avatar asked Dec 14 '17 17:12

ociule


People also ask

Can you use Tensorboard without installing TensorFlow?

Many other ML libraries use tensorboard for logging so I wouldn't state tensorflow as a requirement for tensorboard . The correct and simpler response would be directly install tensorboard either with conda or pip, skipping the install of tensorflow .

Can we use TensorFlow in Google Colab?

Python programs are run directly in the browser—a great way to learn and use TensorFlow. To follow this tutorial, run the notebook in Google Colab by clicking the button at the top of this page. In Colab, connect to a Python runtime: At the top-right of the menu bar, select CONNECT.


1 Answers

EDIT: You probably want to give the official %tensorboard magic a go, available from TensorFlow 1.13 onward.


Prior to the existence of the %tensorboard magic, the standard way to achieve this was to proxy network traffic to the Colab VM using ngrok. A Colab example can be found here.

These are the steps (the code snippets represent cells of type "code" in colab):

  1. Get TensorBoard running in the background.
    Inspired by this answer.

    LOG_DIR = '/tmp/log' get_ipython().system_raw(     'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'     .format(LOG_DIR) ) 
  2. Download and unzip ngrok.
    Replace the link passed to wget with the correct download link for your OS.

    ! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ! unzip ngrok-stable-linux-amd64.zip 
  3. Launch ngrok background process...

    get_ipython().system_raw('./ngrok http 6006 &') 

    ...and retrieve public url. Source

    ! curl -s http://localhost:4040/api/tunnels | python3 -c \     "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])" 
like image 84
Joppe Geluykens Avatar answered Sep 28 '22 07:09

Joppe Geluykens