Skip to main content

System indicators and custom indicators

Show the key Metrics

HyperAI Default display of key indicators during execution. Currently supported are CPU , Memory, gpu-0-memory, gpu-0-util as well as Storage resources. More indicators will be supported in the future.

Custom Metrics

HyperAI Provide one Python The Library HyperAItool Used for in Python Customize some key records in the program metrics And display it on the user's container execution page:

HyperAItool The usage method is as follows:

from HyperAItool import log_param, log_metric, clear_metric

# Record parameters `learning_rate=0.01`
log_param('learning_rate', 0.01)

# The same parameter will record the result of the last request `foo=3`
log_param('foo', 1)
log_param('foo', 2)
log_param('foo', 3)

# Record the running results of the model `precision=0.77`
log_metric('precision', 0.77)

# Same result precision Multiple records will add results. The result is [0.79, 0.82, 0.86]
log_metric('precision', 0.79)
log_metric('precision', 0.82)
log_metric('precision', 0.86)

# Clean up a custom one metric. Please note that this can only be done in a running container
clear_metric('precision')

And Keras combination

Keras The framework provides Callback API Can create according to batch perhaps epoch Level update callback. Using this method. We can then HyperAItool Customization in metrics Add to keras During the training process.

class HyperAIMetricsCallback(tf.keras.callbacks. Callback):
def on_batch_end(self, batch, logs=None):
"""Print Training Metrics"""
if batch % 300 == 0:
HyperAItool.log_metric('acc', float(logs.get('acc')))
HyperAItool.log_metric('loss', float(logs.get('loss')))

model.fit(x_train, y_train,
epochs=epochs,
verbose=1,
callbacks=[HyperAIMetricsCallback()])

stay here You can see the complete code example.