Tensorboard - 无法从 Google 云实例连接

Tensorboard - can't connect from Google Cloud Instance

我正在尝试从我的 google 云 VM 终端中加载 Tensorboard。

tensorboard --logdir logs --port 6006

Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all TensorBoard 2.2.1 at http://localhost:6006/ (Press CTRL+C to quit)

当我点击 link:

Chrome 我得到 error 400

Firefox Error: Could not connect to Cloud Shell on port 6006. Ensure your server is listening on port 6006 and try again.

我添加了一个新的防火墙规则以允许 ip 0.0.0.0/0 的端口 6006,但仍然无法正常工作。我也尝试过使用 --bind_all,但这不起作用。

来自Training a Keras Model on Google Cloud ML GPU

... To train this model now on google cloud ML engine run the below command on cloud sdk terminal

gcloud ml-engine jobs submit training JOB1 
  --module-name=trainer.cnn_with_keras 
  --package-path=./trainer 
  --job-dir=gs://keras-on-cloud
  --region=us-central1 
  --config=trainer/cloudml-gpu.yaml

Once you have started the training you can watch the logs from google console. Training would take around 5 minutes and the logs should look like below. Also you would be able to view the tensorboard logs in the bucket that we had created earlier named ‘keras-on-cloud’

To visualize the training and changes graphically open the cloud shell by clicking the icon on top right for the same. Once started type the below command to start Tensorboard on port 8080.

tensorboard --logdir=gs://keras-on-cloud --port=8080

对于其他为此苦苦挣扎的人,我决定将我的日志输出到 S3 存储桶,然后我没有尝试从 GCP 实例中 运行 tensorboard,我只是在本地 运行 ,使用以下脚本进行测试。

我需要将其放入脚本而不是直接从命令行调用,因为我需要加载我的 AWS 凭证。然后我使用 subprocess 到 运行 命令行功能正常。

env 文件中包含的凭据,使用 python-dotenv

找到
from dotenv import find_dotenv, load_dotenv
import subprocess
load_dotenv(find_dotenv())


if __name__=='__main__':
    cmd = 'tensorboard --logdir s3://path-to-s3-bucket/Logs/'
    p = subprocess.Popen(cmd, shell=True)
    p.wait()



Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.1.1 at http://localhost:6006/ (Press CTRL+C to quit)