Is there any way to use TensorBoard when training a TensorFlow model on Google Colab?
There is an alternative solution but we have to use TFv2.0 preview. So if you don't have problems with the migration try this:
install tfv2.0 for GPU or CPU (TPU no available yet)
CPU
tf-nightly-2.0-preview
GPU
tf-nightly-gpu-2.0-preview
%%capture
!pip install -q tf-nightly-gpu-2.0-preview
# Load the TensorBoard notebook extension
# %load_ext tensorboard.notebook # For older versions
%load_ext tensorboard
import TensorBoard as usual:
from tensorflow.keras.callbacks import TensorBoard
Clean or Create folder where to save the logs (run this lines before run the training fit()
)
# Clear any logs from previous runs
import time
!rm -R ./logs/ # rf
log_dir="logs/fit/{}".format(time.strftime("%Y%m%d-%H%M%S", time.gmtime()))
tensorboard = TensorBoard(log_dir=log_dir, histogram_freq=1)
Have fun with TensorBoard! :)
%tensorboard --logdir logs/fit
Here the official colab notebook and the repo on github
New TFv2.0 alpha release:
CPU
!pip install -q tensorflow==2.0.0-alpha0
GPU
!pip install -q tensorflow-gpu==2.0.0-alpha0