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 import dvclive for epoch in range(NUM_EPOCHS): train_model(...) metrics = evaluate_model(...) for metric_name, value in metrics.items(): dvclive.log(metric_name, value) dvclive.next_step()
$ dvc stage add -n train --live training_metrics -d train.py python train.py
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 tracked 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 these are convenience CLI options. You can still use
dvclive.init()manually, which will override any options sent to
dvc stage add. Just be careful to match the
--livevalue (CLI) and
pathargument (code). Also, note that summary files are never tracked by DVC automatically.
Run the training with
$ 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