Even though DVCLive does not require DVC, they can integrate in several useful ways:
dvc metrics, making it easier to add metrics logging to DVC stages. Those same outputs can be visualized in DVC Studio
We will refer to a training script (
train.py) already using
# 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()
$ dvc stage add -n train --live training_metrics -d train.py python train.py
dvc.yaml will contain a new
train stage with the DVCLive configuration (in
stages: train: cmd: python train.py deps: - train.py live: training_metrics: summary: true html: true
The value passed to
training_metrics) became the directory
for DVCLive to write logs in, and DVC will now
track it. Other supported
command options for the DVC integration:
--live-no-cache <path>- specify a DVCLive log directory
pathbut don't track it with DVC. Useful if you prefer to track it with Git.
--live-no-summary- deactivates summary generation.
--live-no-html- deactivates HTML report generation.
Note that summary files are never tracked by DVC
$ dvc repro train
After that's finished, you should see the following content in the project:
$ ls dvc.lock training_metrics train.py dvc.yaml training_metrics.json
.tsv files generated under
training_metrics can be visualized with
In addition to the outputs described in the Quickstart, DVC generates an HTML report.
If you open
training_metrics_dvc_plots/index.html in a browser, you'll see a
plot for metrics automatically updated during the model training!
When used alongside DVC, DVCLive can create checkpoint signal files used by DVC experiments
This will save the metrics, plots, models, etc. associated to each
You can learn more about how to use them in the Checkpoints User Guide.