Skip to content

Instantly share code, notes, and snippets.

@eileen-code4fun
Created May 27, 2021 15:30
Show Gist options
  • Save eileen-code4fun/6a918fa768f70cd4c3d79afb10dd2989 to your computer and use it in GitHub Desktop.
Save eileen-code4fun/6a918fa768f70cd4c3d79afb10dd2989 to your computer and use it in GitHub Desktop.
CIFAR10 HPT Metrics
import tensorflow as tf
import hypertune
hpt = hypertune.HyperTune()
class CustomCallback(tf.keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs=None):
hpt.report_hyperparameter_tuning_metric(
hyperparameter_metric_tag='val_accuracy',
metric_value=logs['val_accuracy'],
global_step=epoch
)
custom_callback = CustomCallback()
model.fit(train_dataset, epochs=args.epochs, validation_data=val_dataset, callbacks=[custom_callback])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment