我正在一台具有良好 GPU 的远程计算机上训练神经网络,我通常通过 SSH(文本控制台,无图形模式)启动训练过程:
ssh user@remote_host
# then, after authentification on the remote:
python3 model20210625_1528.py
# this python file contains: model.fit(X, Y, ..., verbose=1)
# now looking at the progress bar...
# 61/7101 [..............................] - ETA: 14:04 - loss: 0.1278
这个工作流程不是很方便,因为我无法实时看到损失曲线。我将使用 Jupyter 和/或 Tensorboard 实时查看曲线的演变like here。
阅读文档后,我看到通过向 fit
函数添加回调来使用 Tensorboard:
tb_callback = tf.keras.callbacks.TensorBoard('./logs', update_freq=1)
model.fit(x_train, y_train, callbacks=[tb_callback])
但随后 Tensorboard 文件 ./logs/*
将被写入远程计算机。
问题:如何在本地计算机的浏览器中使用 Tensorboard(并且能够看到损失曲线等)而 Tensorboard log
文件保存在远程计算机上?
我们是否应该使用 SSH 隧道或类似技术,以便我的本地计算机可以访问远程的 Tensorboard logs/*
文件?
TL;DR:在远程计算机上训练神经网络并能够在本地计算机的浏览器中看到 Tensorboard 曲线的标准方法是什么?
注意:我已阅读答案 How can I run Tensorboard on a remote server?,但我们是否需要通过 SSH 使用两个 -L port:ip:port
端口重定向,一个用于 Tensorboard,另一个用于 Jupyter?