gpt4 book ai didi

tensorflow - 我可以将 TensorBoard 与 Google Colab 一起使用吗?

转载 作者:行者123 更新时间:2023-12-02 23:49:54 24 4
gpt4 key购买 nike

在 Google Colab 上训练 TensorFlow 模型时是否可以使用 TensorBoard?

最佳答案

编辑:您可能想给官方 %tensorboard magic尝试一下,从 TensorFlow 1.13 开始可用。

<小时/>

%tensorboard 魔法存在之前,标准方法实现这一目标的方法是使用以下命令将网络流量代理到 Colab VM ngrok 。可以找到 Colab 示例 here .

这些是步骤(代码片段代表 colab 中“代码”类型的单元格):

  1. 让 TensorBoard 在后台运行。
    灵感来自 this answer .

    LOG_DIR = '/tmp/log'
    get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
    .format(LOG_DIR)
    )
  2. 下载并解压ngrok
    将传递给 wget 的链接替换为适合您操作系统的正确下载链接。

    ! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
    ! unzip ngrok-stable-linux-amd64.zip
  3. 启动 ngrok 后台进程...

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

    ...并检索公共(public)网址。 Source

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

关于tensorflow - 我可以将 TensorBoard 与 Google Colab 一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47818822/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com