Skip to content

Config & attributes

Beyond time-series metrics, a run carries attributes — metadata such as hyperparameters, tags, and a description. These show up on a run’s Overview and as columns/filters in the runs table.

metrana.log_config({"optimizer": {"name": "adam", "lr": 3e-4}, "batch_size": 256})
metrana.set_tags(["baseline", "v2"]) # replace the tag set
metrana.add_tags(["ablation"]) # add without removing
metrana.remove_tags(["baseline"]) # remove
metrana.set_description("LR sweep, seed 0")

config passed to init() is logged the same way as log_config — nested dicts/lists flatten under the config/ prefix (see Naming rules):

metrana.init(
workspace_name="ws", project_name="proj", run_name="run-001",
config={"optimizer": {"name": "adam", "lr": 3e-4}, "batch_size": 256},
tags=["baseline"],
description="LR sweep, seed 0",
)

For attributes outside config, use log_attributes(prefix_path, value). The prefix_path is a /-delimited path; value may be a scalar or a nested dict/list that flattens beneath it:

metrana.log_attributes("dataset", {"name": "imagenet", "size": 1_281_167})
metrana.log_attributes("env/seed", 0)

Reinforcement-learning runs have a distinct, env-scoped attribute kind for configuration that varies per environment, keyed by env_id (and optionally episode):

metrana.log_env_attributes(env_id, value, episode=None)

These are separate from run-level attributes and surface in the run’s Environments views.

Omit episode to log configuration that holds for the environment across all episodes — its fixed setup:

metrana.log_env_attributes("env0", {"difficulty": "hard", "map": "maze-7"})

Pass episode to log configuration that changes over the course of the run. Each update takes effect from its episode and stays in force until the next update for that environment — a step function over episodes:

metrana.log_env_attributes("env0", {"opponent": "random"}, episode=0)
metrana.log_env_attributes("env0", {"opponent": "self-play"}, episode=5)
metrana.log_env_attributes("env0", {"opponent": "league"}, episode=10)

With those three updates, env0’s opponent is random for episodes 0–4, self-play for 5–9, and league from 10 onward. You log only when a value changes; the portal forward-fills it across the intervening episodes.