Skip to content
Edit on GitHub

Get Started

DVCLive is a Python library for logging machine learning parameters, 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.


Initialize DVCLive

from dvclive import Live

live = Live()

See Live() for details.

(Optionally) Log parameters

live.log_param("num_classes", 10)

See Live.log_param().

params = {
    "num_classes": 10,
    "metrics": ["accuracy", "mae"],
    "optimizer": "adam"

See Live.log_params().

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


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:


from dvclive import Live

live = Live()


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

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



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

$ tree
├── dvclive
│   ├── images
│   │   └── img.png
│   ├── params.yaml
│   ├── 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_param()/Live.log_params(), Live.log_image() and Live.log_plot() for more details.

Metrics report

If and when step is updated, DVCLive generates or updates a report in dvclive/report.{format} which will contain all the logged data.

The format can be HTML) or Markdown depending on the value of the report argument passed to Live().

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

What next?

Learn how to use DVCLive alongside other tools:


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

Edit on GitHub

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

Discord Chat