尝试将 tensorboard 与 google colab 一起使用时出错

Posted

技术标签:

【中文标题】尝试将 tensorboard 与 google colab 一起使用时出错【英文标题】:Error on trying to use tensorboard with google colab 【发布时间】:2019-08-24 17:52:15 【问题描述】:

我在尝试将 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'])"

【问题讨论】:

【参考方案1】:

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

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

【讨论】:

工作链接colab.research.google.com/github/tensorflow/tensorboard/blob/…【参考方案2】:

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

先卸载tensorboard和ten​​sorflow:

!pip3 uninstall tensorboard
!pip3 uninstall tensorflow

然后安装 tf-nightly:

!pip3 install --ignore-installed tf-nightly

然后在 google colab 中运行 tensorboard:

%load_ext tensorboard
%tensorboard --logdir logs_base_dir

【讨论】:

以上是关于尝试将 tensorboard 与 google colab 一起使用时出错的主要内容,如果未能解决你的问题,请参考以下文章