wandb.log(dict)
to log a dictionary of metrics, media, or custom objects to a step. Each time you log, we increment the step by default, so you can see how your models and data evolve over time.wandb.run.summary["best_accuracy"] = best_accuracy
wandb.log
, like this: wandb.log({"acc'": 0.9, "loss": 0.1})
and they will both be available to plot against in the UIwandb.log({'acc': 0.9, 'epoch': 3, 'batch': 117})
. To set the default x-axis for a given metric use Run.define_metric()​wandb.log
supports the logging of a wide variety of data types, from media like images and videos to tables and charts.wandb
Python library.wandb.log
is tracked over time, forming the "history" of a run. By default, each call to wandb.log
is a new step and all of our charts and panels use the history step as the x-axis.wandb.log({'loss': 0.1, 'epoch': 1, 'batch': 3})
. In the UI you can switch between x-axes in the chart settings.wandb.log()
as follows:step
, W&B will collect the keys and values from each call in one unified dictionary. As soon you call wandb.log()
with a different value for step
than the previous one, W&B will write all the collected keys and values to the history, and start collection over again. Note that this means you should only use this with consecutive values for step
: 0, 1, 2, .... This feature doesn't let you write to absolutely any history step that you'd like, only the "current" one and the "next" one.commit=False
in wandb.log
to accumulate metrics, just be sure to eventually call wandb.log
with commit=True
(the default) to persist the metrics.summary
dictionary. For values that are logged with wandb.log
, we automatically set summary to the last value added. You can also add metrics or media to the summary directly or overwrite the default values. If a summary metric is modified, the previous value is lost.define_metric
define_metric
to set a custom x axis or capture a custom summary of a metric.wandb.summary
. For example, you might want to capture the maximum accuracy or the minimum loss value, instead of the final value.step
. Sometimes, you might want to log to a previous step, or use a different x-axis."train/"
to the x-axis "train/step"
:summary
argument in define_metric
which accepts the following values: "min"
, "max"
, "mean"
,"best"
, "last"
and "none"
. The "best"
parameter can only be used in conjunction with the optional objective
argument which accepts values "minimize"
and "maximize"
. Here's an example of capturing the lowest value of loss and the maximum value of accuracy in the summary, instead of the default summary behavior, which uses the final value from history.