Remote Tensorboard Viewing on Your Local Browser

Ehsan Yousefzadeh-Asl-Miandoab
2 min readJan 6, 2022

--

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 --bind_all

Sign up to discover human stories that deepen your understanding of the world.

--

--

No responses yet

Write a response