Logging Data
Configs #
Use bracket assignment to log config values. Scalars are stored directly; dictionaries and argparse.Namespace objects are flattened under the key as a namespace prefix.
# Scalar values
run["score"] = 0.97
run["model_name"] = "resnet50"
# Dictionaries (flattened under key prefix)
run["parameters"] = {"lr": 0.001, "batch_size": 32}
# Stores: parameters/lr = 0.001, parameters/batch_size = 32
# Nested dictionaries
run["parameters"] = {"train": {"max_epochs": 10}}
# Stores: parameters/train/max_epochs = 10
# argparse Namespace
run["parameters"] = argparse.Namespace(lr=0.01, batch=32)
# Stores: parameters/lr = 0.01, parameters/batch = 32Copied!
Batch methods are also available:
# Flat key-value pairs
run.log_configs({"learning_rate": 0.001, "optimizer": "adam"})
# Flatten nested dicts
run.log_configs({"model": {"hidden": 256, "layers": 4}}, flatten=True)
# Default flatten=True handles nested dicts
run.log_configs({"parameters": {"epoch_nr": 5, "batch_size": 32}})Copied!
Supported config value types:
| Python Type | Stored as |
|---|---|
bool | "true" / "false" |
int | "42" |
float | "3.14" |
str | "hello" |
datetime | ISO 8601 string |
None | "" |
Metrics #
Use .log(..., step=...) to log numeric values as time series.
run["train/loss"].log(0.9, step=0)
run["train/loss"].log(0.8, step=1)
run["train/loss"].log(0.7, step=2)
# Custom step values
run["metric"].log(value=acc, step=epoch)
# Float steps are supported
run["metric"].log(1.0, step=0.5)Copied!
Batch method for logging multiple metrics at once:
run.log_metrics({"loss": 0.5, "accuracy": 0.85}, step=100)Copied!
String Series #
Log string values to create text series — useful for logs, prompts, generated output, or any text data over time.
run["generated_text"].log("hello world", step=0)
run["generated_text"].log("another sample", step=1)
# With explicit step
run["log"].log("Epoch 1 complete", step=1)Copied!
Batch method:
run.log_strings({"output": "Generated text here..."}, step=100)Copied!