Step 5: Train a Model

Use the code below to run TensorBoard on the model in your pipeline.


In [ ]:
from __future__ import print_function

import os
import webbrowser
import tensorflow as tf

!pip install -q tensorboard
tf.get_logger().propagate = False

pipeline_name = 'taxi'
tensorboard_logdir = os.path.join(os.environ['HOME'], 'airflow/tfx/pipelines', pipeline_name, 'Trainer/model')
print('tensorboard_logdir: {}'.format(tensorboard_logdir))
os.environ['TENSORBOARD_LOGDIR'] = tensorboard_logdir

Start TensorBoard

Note: This cell continues to run until you interrupt the kernel.

Wait for TensorBoard to start and then open a browser tab and go to http://localhost:6006


In [ ]:
!tensorboard --bind_all --logdir="${TENSORBOARD_LOGDIR}"

In [ ]: