MLearning.ai
Published in

MLearning.ai

Remote Tensorboard Viewing on Your Local Browser

TensorFlow (TF) is one of the popular Machine Learning (ML) frameworks. It has eased the life of ML developers, especially Deep Learning developers. Tensorboard is TF’s visualization toolkit. This toolkit visualizes metrics like accuracy and loss, model graph (operations and layers), and many others that you know about them (if you don’t know you can learn from here). For using this toolkit, some lines of code must be added to the Python source code for logging like as follows:

import datetime# Create a TensorBoard callbackprofile_logs = "logs/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")tboard_callback = tf.keras.callbacks.TensorBoard(log_dir = profile_logs, histogram_freq = 1, profile_batch = '500,520')model.fit(training_data, training_labels, epochs=15,   callbacks=[tboard_callback])

Then with the following command, Tensorboard will be launched on the 6006 port of the server you are connecting with an SSH connection to it.

$ tensorboard --log-dir=logs

But, you want to be able to open and view the Tensorboard on your local machine browser. For this purpose, follow the following steps:

  1. Connect to the server by transferring port 6006 of the remote server into a port you like to view the Tensorboard (like 16006).
$ ssh -L 16006:127.0.0.1:6006 user@server

2. Launch the Tensorboard

$ tensorboard --logdir="profile-logs" --port=6006

3. Open your browser and enter:

127.0.0.1:16006

or

localhost:16006

Reference and Helpful Links

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store