Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

launching tensorboard from google cloud datalab

I need help in luanching tensorboard from tensorflow running on the datalab, My code is the followings (everything is on the datalab):

import tensorflow as tf

with tf.name_scope('input'):
  print ("X_np")
  X_np = tf.placeholder(tf.float32, shape=[None, num_of_features],name="input")

with tf.name_scope('weights'):
  print ("W is for weights & - 15 number of diseases")
  W = tf.Variable(tf.zeros([num_of_features,15]),name="W")

with tf.name_scope('biases'):
  print ("b")
  #todo:authemate for more diseases
  b = tf.Variable(tf.zeros([15]),name="biases")

with tf.name_scope('layer'):
  print ("y_train_np")
  y_train_np = tf.nn.softmax(tf.matmul(X_np,W) + b)

with tf.name_scope('correct'):
  print ("y_ - placeholder for correct answer")
  y_ = tf.placeholder(tf.float32, shape=[None, 15],name="correct_answer")

with tf.name_scope('loss'):
  print ("cross entrpy")
  cross_entropy = -tf.reduce_sum(y_*tf.log(y_train_np))

# % of correct answers found in batch
print("is correct")
is_correct = tf.equal(tf.argmax(y_train_np,1),tf.argmax(y_,1))
print("accuracy")
accuracy = tf.reduce_mean(tf.cast(is_correct,tf.float32))

print("train step")
train_step = tf.train.GradientDescentOptimizer(0.01).minimize(cross_entropy)
# train data and get results for batches
print("initialize all varaible")
init = tf.global_variables_initializer()

print("session")
sess = tf.Session()
writer = tf.summary.FileWriter("logs/", sess.graph)
init = tf.global_variables_initializer()
sess.run(init)

!tensorboard --logdir=/logs

the output is: Starting TensorBoard 41 on port 6006 (You can navigate to http://172.17.0.2:6006)

However, when I click on the link, the webpage is empty

Please let me know what I am missing. I am expecting to see the graph. later i would like to generate more data. Any suggestion is appreciated.

Many thanks!

like image 562
eilalan Avatar asked Jul 12 '17 01:07

eilalan


People also ask

How do I open TensorBoard in GCP?

Use the Google Cloud console To open the Vertex AI TensorBoard UI, click Open TensorBoard next to your experiment.

Is datalab deprecated?

Datalab was deprecated on September 2, 2022. Vertex AI Workbench provides a notebook-based environment that offers capabilities beyond Datalab. We recommend that you use Vertex AI Workbench for new projects and migrate your Datalab notebooks to Vertex AI Workbench.

What is datalab in GCP?

Use Cloud Datalab to easily explore, visualize, analyze, and transform data using familiar languages, such as Python and SQL, interactively. Pre-installed Jupyter introductory, sample, and tutorial notebooks, show you how to: Access, analyze, monitor, and visualize data.

Is datalab free?

There is no charge for using Google Cloud Datalab. However, you do pay for any Google Cloud Platform resources you use with Cloud Datalab, for example: Compute resources: You incur costs from the time of creation to the time of deletion of the Cloud Datalab VM instance.


1 Answers

If you are using datalab, you can use tensorboard as below:

from google.datalab.ml import TensorBoard as tb

tb.start('./logs')

http://googledatalab.github.io/pydatalab/google.datalab.ml.html

like image 128
이승훈 Avatar answered Nov 11 '22 11:11

이승훈