Skip to content
Edit on GitHub

Get Started

DVCLive is a Python library for logging machine learning metrics and other metadata in simple file formats, which is fully compatible with DVC.

If you use one of the supported ML Frameworks, you can jump directly to its corresponding page.

Workflow

Initialize DVCLive

from dvclive import Live

live = Live()

See Live() for details.

Log data

live.log("acc", 0.9)

See Live.log().

img = np.ones((500, 500, 3), np.uint8)
live.log_image("image.png", img)

See Live.log_image().

y_true = [0, 0, 1, 1]
y_pred = [0.2, 0.5, 0.3, 0.8]
live.log_plot("roc", y_true, y_score)

See Live.log_plot().

(Optionally) Update the step number

live.next_step()

See Live.next_step() and Live.set_step() for details.

Putting all together

Joining the above snippets, you can 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:

$ tree
├── dvclive
│   ├── images
│   │   └── img.png
│   ├── plots
│   │   └── roc.json
│   └── scalars
│       └── acc.tsv
└── dvclive.json

The contents of the dvclive folder and dvclive.json will vary depending on the type of data you have logged and whether you have updated the step value or not.

See Live.log(), Live.log_image() and Live.log_plot() for more details.

HTML report

If and when step is updated, DVCLive generates or updates an HTML report in dvclive/report.html which will contain all the logged data.

If you don't update the step number, the HTML report won't be generated unless you call Live.make_report() directly.

What next?

Learn how to use DVCLive alongside other tools:

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