Search code examples
pythontensorflowtensorboardgoogle-colaboratory

Error on trying to use tensorboard with google colab


I am getting an error on trying to use tensorboard with google collab. I am using ngork to run tensorboard. The error is as follows

Error Snapshot

The code I am using to do the above-mentioned operation is as follows

LOG_DIR = '/content/drive/My Drive/Practice/Su'
get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
    .format(LOG_DIR)
)

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

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

! curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0] 
['public_url'])"

Solution

  • Skip ngrok and use the built-in %tensorboard magic.

    Here's a demo: https://colab.research.google.com/github/tensorflow/tensorboard/blob/master/docs/r2/tensorboard_in_notebooks.ipynb