Even though DVCLive does not require DVC, they can integrate in a couple useful ways:
DVCLive is also capable of generating checkpoint signal files used by DVC experiments
We will refer to a training script (
train.py) already using
If you use one of the supported ML Frameworks, you can jump to its corresponding page to find an example usage.
# train.py from dvclive import Live live = Live("training_metrics") 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 \ --name train \ --deps train.py \ --metrics-no-cache training_metrics.json \ --plots-no-cache training_metrics/scalars \ python train.py
Note that the paths indicated in the
plots options match the
path passed to
Live() in the Python code (
stages: train: cmd: python train.py deps: - train.py metrics: - training_metrics.json: cache: false plots: - training_metrics/scalars: cache: false
$ dvc repro train
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 └── train.py
The HTML report in
training_metrics/report.html will contain all the logged data and will be
automatically updated during training on each
If you don't update the step number, the HTML report won't be generated unless
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
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.