在谷歌C olab环境中运行云TPU分析器

问题描述 投票:1回答:2

我运行谷歌Colab笔记本,我试图捕捉TPU分析数据在TensorBoard使用,但我不能让capture_tpu_profile在后台运行,而运行我TensorFlow代码。

到目前为止,我试图在后台运行的采集过程:

!capture_tpu_profile --logdir=gs://<my_logdir> --tpu=$COLAB_TPU_ADDR &

!bg capture_tpu_profile --logdir=gs://<my_logdir> --tpu=$COLAB_TPU_ADDR
python tensorflow google-colaboratory google-cloud-tpu
2个回答
5
投票

原来的方式来做到这一点的同时,开始从蟒蛇直接像这样的过程中(我也不得不修改从--tpu--service_addr参数):

import subprocess
subprocess.Popen(["capture_tpu_profile","--logdir=gs://<my_logdir>", "--service_addr={}".format(os.environ['COLAB_TPU_ADDR'])])

check=True使得如果失败的命令引发异常。


© www.soinside.com 2019 - 2024. All rights reserved.