Edit on GitHub

Get Started

DVCLive is a simple Python library whose interface consists of three main steps.

Steps

To get it up and running you just need to follow these steps:

1. Initialize DVCLive

from dvclive import Live

live = Live()

See Live() for details.

2. Log metrics

live.log(metric_name, value)

See Live.log() for details.

3. Increase the step number

live.next_step()

See Live.next_step() for details.

Putting all together

Using the above steps, you can easily include DVCLive in your training code:

# train.py

from dvclive import Live

live = Live()

for epoch in range(NUM_EPOCHS):
    train_model(...)
    metrics = evaluate_model(...)

    for metric_name, value in metrics.items():
        live.log(metric_name, value)

    live.next_step()

Outputs

After you run your training code, you should see the following content in the project:

$ ls
dvclive        train.py
dvclive.json

Metrics Logs

For each {metric_name}, DVCLive produces metrics logs under dvclive/{metric_name}.tsv:

$ cat dvclive/{metric_name}.tsv
timestamp	step	{metric_name}
1614129197192	0	0.7612833380699158
1614129198031	1	0.8736833333969116
1614129198848	2	0.8907166719436646

Metrics Summary

In addition, when summary is enabled (True by default), DVCLive generates a metrics summary with the latest metrics:

$ cat dvclive.json
{
  "step": 2,
  "{metric_name}": 0.8907166719436646
}

What next?

There are other ways to use DVCLive:

Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat