I am referring to the links below to use Tensorboard in Sagemaker Script Mode method.
https://www.tensorflow.org/tensorboard/get_started
Below is my tensorboard callback in my training script which is a .py file
model = create_model()
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
log_dir = "logs/fit/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)
model.fit(x=x_train,
y=y_train,
epochs=5,
validation_data=(x_test, y_test),
callbacks=[tensorboard_callback])
In a notebook, I am creating the below Tensorflow Estimator where I am passing the above Script file name as entry_point.
estimator = TensorFlow(
entry_point='Script_File.py',
train_instance_type=train_instance_type,
train_instance_count=1,
model_dir=model_dir,
hyperparameters=hyperparameters,
role=sagemaker.get_execution_role(),
base_job_name='tf-fashion-mnist',
framework_version='1.12.0',
py_version='py3',
output_path=<S3 Path>,
script_mode=True,
)
I am using the below code in my notebook to start the training.
estimator.fit(inputs)
Once training is done, I am using the below code in a Terminal(have tried in my Notebook cell as well) to launch tensorboard.
tensorboard --logdir logs/fit
But in the tensorboard I am not able to view any graphs. It is showing the message "Failed to fetch runs". Is there something that I am missing? Or do I have to do any extra setting in my script to see my logs in Tensorboard?