尝试将 tensorboard 与 google colab 结合使用时出错

Error on trying to use tensorboard with google colab

我在尝试将 tensorboard 与 google collab 结合使用时遇到错误。 我正在使用 ngork 来 运行 张量板。报错如下

我用来做上述操作的代码如下

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'])"

跳过 ngrok 并使用内置的 %tensorboard 魔法。

这是一个演示: https://colab.research.google.com/github/tensorflow/tensorboard/blob/master/docs/r2/tensorboard_in_notebooks.ipynb

这是一个对我有用的解决方案:

首先卸载tensorboard和ten​​sorflow:

!pip3 uninstall tensorboard
!pip3 uninstall tensorflow

然后安装 tf-nightly:

!pip3 install --ignore-installed tf-nightly

然后 运行 tensorboard inside google colab:

%load_ext tensorboard
%tensorboard --logdir {logs_base_dir}