Get Tensorboard Up & Running on Win10 & Mac

Chaz Frazer
5 min readJul 25, 2021

--

Amazing, once you get it to actually work…

Tensorboard is a great tool for visualizing in real-time the neural network modeling process.

Tensorboard is great for live-model tracking and visualizations across node epochs, as well as for creating interactive insights you can share in presentations and applications. The visual accompaniment to Tensorflow however runs into issues on Windows 10, and set up can be frustrating if not utilizing the correct callbacks and server direction.

As one who suffered from trying to get Tensorboard to work correctly with Windows 10, I figured to save you from this issue by compiling my workaround and callback settings for the masses. Once you have it going, you’ll never want to run a model without it ever again.

These methods also work for Mac, although with the Apple route there are other ways to point to the application that unfortunately does not work on Windows. Assume everything covered here works for both platforms.

Setup and Callbacks

I do most of my Python coding work in Jupyter Notebook, and markdown work in Jupyter Lab. Tensorboard does have an in-notebook call that looks into your log directory to visualize within the notebook, but more often than not this throws an error; or worse yet, the code just doesn’t do anything, and you’re left wondering if anything is actually happening in the background.

Firstly, before anything, we need to define our log directory where we will be stashing the log files generated by the program and called in the model compile.

Using Tensorflow callbacks to set the log directory. Be sure it is in its own subfolder in your repository and has subfolders in the log directory as well to avoid issues.

Once this step is completed, you are now almost ready to compile and begin your modeling process. The Tensorboard callback takes the name of your log directory, alongside the DateTime time delta of when the modeling process is instantiated.

Be sure to set up your log directly as cleanly as possible — utilizing sub-folders and renaming files appropriately, as having multiple log files in one sub-directory can really mess up how Tensorboard compiles the log files and result in some pretty nasty visualizations.

Having clean directories and subfolders for subsequent model runs is crucial to avoid issues once the log files are generated through the model compile.

With this, now we are ready to begin. Callbacks set, model set, and log directory nice and clean. Instantiating Tensorboard from the model compile is as simple as including it alongside any other callbacks you may be utilizing on the current model:

Our Tensorboard callback defined previously can be called as a simple variable in our model compilation when instantiating the model run.

I previously mentioned briefly the ability to call the Tensorboard callback inside of the Jupyter Notebook, however doing this seems to run into multiple errors, and has even resulted in the modeling process freezing or worse yet, a complete Jupyter server crash. If you have been running your model for a while and would like to take a peek at Tensorboard, I would not recommend doing this. Still, if you would like to experiment with it and get it up and running on your machine, please feel free. Let me know if you get it to work properly!

Create a new cell and use this code to instantiate a Tensorboard session in-notebook, pointing it to the directory of your logs created earlier.

Server Connections for Windows 10 & Mac

The bread and butter of this blog is to get Tensorboard running on Windows 10, and without further ado, here is how we’ll accomplish this.

  • First, open a new terminal window and navigate to your repository location’s log directory created earlier…
Navigate to your log directory
  • Secondly, we want to point to the subfolder within the log directory that includes the folder created with the current DateTime time delta. Do this by copying the entire pathway to the subfolder containing the model logs you are trying to view…
Make sure to include the entire pathway pointing to the subfolder containing the log files of the current model you are running.
  • Lastly, after calling your path to logs, a pop-up will appear directing you to a secure HTTP address that you copy and paste into your web browser…
Copy and paste the HTTP address into your web browser and…
Viola! We have Tensorboard up and running.

After these steps, you are now free to explore your live-running model while it chugs along in the background. For best performance, depending on the type of model you are running, it may be best to run the model in the cloud while playing with Tensorboard on your local machine, freeing up resources.

Conclusion

While being an invaluable tool that you can use to visualize the modeling process, Tensorboard also allows you to run calculations on the observed epochs of the model, giving valuable data and information in real-time as it comes in. If you were having issues getting the application to connect or find your log directories, I hope this post was of some help. I’m still curious about getting Tensorboard to work within Jupyter Notebook, so feel free to contact me if you’ve overcome that hurdle!

--

--

Chaz Frazer
Chaz Frazer

Written by Chaz Frazer

Data Scientist/Esports Analyst/Linguist/Japanese Interpreter: I do a lot in the intersection of gaming and data, helping esports grow.

Responses (1)