WandbNamer#
- class WandbNamer(keys=(), sep='-', format_numbers=True, extra=None)[source]#
Bases:
HookBaseAuto-generate
cfg.wandb_run_namefrom selected config values.Joins the resolved values of the requested (possibly nested) config keys with a separator, optionally formatting large numbers with K/M/B suffixes, then appends any
extrastrings, to build a descriptive W&B run name. Runs once inmodify_config(before the writer is built), so the name is in place before logging starts. Registered asWandbNamer.- Parameters:
keys (tuple) – Config keys to include in the name, in order. Supports dotted nested access such as
"data.train.max_len"or"model.type"; keys that resolve toNoneare skipped. Defaults to().sep (str) – Separator joining the parts. Defaults to
"-".format_numbers (bool) – If
True, render numeric values with K/M/B suffixes (e.g.1000000->"1M"). Defaults toTrue.extra (str or tuple, optional) – Extra string(s) appended after the keyed parts, e.g.
"fft"or"scratch". A bare string is wrapped to a one-tuple. Defaults toNone.
Note
If
wandb_run_namewas set on the command line (present incfg._cli_options), this hook leaves it untouched. So--options wandb_run_name=my-nameoverrides the auto-generated name.Example
Add to
cfg.hooks; once inmodify_config(before the writer is built) it setscfg.wandb_run_namefrom the joined config values:hooks = [ dict(type="WandbNamer", keys=("model.type", "data.train.max_len", "seed"), extra="fft"), ] # → sets cfg.wandb_run_name = "Sonata-v1m1-1M-0-fft" (left untouched if # wandb_run_name was passed on the CLI)