另一个 Chrome 选项卡中的 Google Colab TensorBoard

lr1*_*100 1 tensorboard pytorch google-colaboratory

我正在学习 PyTorch 教程,目前正在学习 TensorBoard 教程。通过研究,我已经能够让它通过另一个选项卡内联工作。我的偏好是将其保留在另一个将自动更新的选项卡中。

下面描述的方法使用ngrok: https://medium.com/@iamsdt/using-tensorboard-in-google-colab-with-pytorch-458f9bb95212

然而,它是不稳定的,因为它会到达许多连接然后断开:

Too many connections! The tunnel session '1Z8HZHdl5gLd1xJVdx5Vqqpl9dW' has violated the rate-limit policy of 20 connections per minute by initiating 133 connections in the last 60 seconds. Please decrease your inbound connection volume or upgrade to a paid plan for additional capacity.

The error encountered was: ERR_NGROK_702
Run Code Online (Sandbox Code Playgroud)

当发生这种情况时,我必须重新启动整个内核并重新开始。非常令人沮丧。

这确实不是我正在寻找的解决方案。有人有解决方案吗?

我想谷歌应该有一个解决方案......

Che*_*ian 6

更新:这是一个示例单元格,其中包含两个按钮,用于在另一个窗口中打开 Tensorboard 并将其隐藏在 Colab 笔记本上:

%load_ext tensorboard
%tensorboard --logdir="logdir"

import IPython

display(IPython.display.HTML('''
<button id='open_tb'>Open TensorBoard</button> 
<button id='hide_tb'>Hide TensorBoard</button> 
<script>document.querySelector('#open_tb').onclick = () => { window.open(document.querySelector('iframe').src, "__blank") }
        document.querySelector('#hide_tb').onclick = () => { document.querySelector('iframe').style.display = "none" }</script>'''))
Run Code Online (Sandbox Code Playgroud)

您可以通过将嵌入的 Colab Tensorboard iFrame URL 复制到另一个选项卡来简单地完成此操作。 请参阅此处的 gif 示例

  • 谢谢你!谷歌需要聘请一些优秀的工程师,这样我们就不必破解基本功能。 (2认同)