Collect metadata

See also

This how-to is a part of our Bring your existing projects to Valohai series.

Valohai allows you to easily collect any metrics as Valohai metadata. You can easily collect metrics by simply printing them as JSON key-value pairs in your execution.

Collecting metadata from a Valohai execution allows you to easily sort, filter, and compare different executions. It’s up to you to define which metrics are you collecting as metadata.

import valohai

with valohai.metadata.logger() as logger:
    logger.log("epoch", epoch)
    logger.log("accuracy", accuracy)
    logger.log("loss", loss)
import json

    "epoch": epoch,
    "accuracy": accuracy,
    "loss": loss

metadataEvent <- list()
metadataEvent[["epoch"]] <- epoch
metadataEvent[["accuracy"]] <- accuracy
metadataEvent[["loss"]] <- loss

write(toJSON(metadataEvent, auto_unbox=TRUE), stdout())
Metadata chart comparison