Skip to content
Edit on GitHub

DVCLive with DVC

Even though DVCLive does not require DVC, they can integrate in a couple useful ways:


We will refer to a training script ( already using dvclive:

If you use one of the supported ML Frameworks, you can jump to its corresponding page to find an example usage.


from dvclive import Live

live = Live("training_metrics")


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

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


Let's use dvc exp init --live to create a stage to wrap this code (don't forget to dvc init first):

$ dvc exp init --live "training_metrics" \
--code "" \

Note that the path passed to the --live option ("training_metrics") matches the path passed to Live() in the Python code.

dvc.yaml will contain a new train stage using the DVCLive outputs as dvc metrics and dvc plots:

    cmd: python
      - training_metrics.json:
          cache: false
      - training_metrics/scalars:
          cache: false

Run the training with dvc repro or dvc exp run:

$ dvc repro train

When using DVC Checkpoints and/or enabling DVCLive's resume you need to add the flag persist: true to all DVCLive outputs.

Passing --type checkpoint to dvc exp init will take care of doing this.


After that's finished, you should see the following content in the project:

$ tree
├── dvc.lock
├── dvc.yaml
├── training_metrics
│   ├── report.html
│   └── scalars
│       ├── acc.tsv
│       └── loss.tsv
├── training_metrics.json

The metrics summary in training_metrics.json can be used by dvc metrics and visualized with dvc exp show/dvc exp diff.

The metrics history training_metrics/scalars can be visualized with dvc plots.

The metrics report in training_metrics/report.html will contain all the logged data and will be automatically updated during training on each step update!

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

Iterative Studio

Iterative Studio will automatically parse the outputs generated by DVCLive, allowing to compare and visualize experiments using DVCLive in Iterative Studio.

dvclive studio plots


When used alongside DVC, DVCLive can create checkpoint signal files used by DVC experiments

This will save all the outputs (metrics, plots, models, etc.) associated to each step.

You can learn more about how to use them in the Checkpoints User Guide.

If you don't update the step number, checkpoints won't be created.


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

Edit on GitHub

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

Discord Chat