Created
May 27, 2021 15:30
-
-
Save eileen-code4fun/6a918fa768f70cd4c3d79afb10dd2989 to your computer and use it in GitHub Desktop.
CIFAR10 HPT Metrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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