How to use Tensorboard in Colaboratory

岁酱吖の 提交于 2019-12-07 10:26:28

问题


Is it possible to use Tensorboard in Colaboratory. Running tensorboard locally shows rich information about model behaviour like loss etc..is it possible get same information when working with Colaboratory(https://colab.research.google.com).


回答1:


You have two options you can use one of the python programs that allows you to tunnel to the machine instance that is hosting your python app. I tested this one: https://github.com/taomanwai/tensorboardcolab

!pip install -U tensorboardcolab
from tensorboardcolab import *
import shutil

#clean out the directory
shutil.rmtree('./Graph', ignore_errors=True)
os.mkdir('./Graph')

tf.reset_default_graph()

#will start the tunneling and will print out a link:
tbc=TensorBoardColab()

#**here you construct your model**

sess = tf.Session()
output = sess.run(....)
sess.close()

train_writer = tbc.get_writer();
train_writer.add_graph(sess.graph)

train_writer.flush();
tbc.close()

The other solution is to zip all the files and download them to your machine.



来源:https://stackoverflow.com/questions/48407779/how-to-use-tensorboard-in-colaboratory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!