DVCLive is a Python library for logging machine learning 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.
from dvclive import Live
live = Live()
See Live()
for details.
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()
.
live.next_step()
See Live.next_step()
and Live.set_step()
for details.
Joining the above snippets, you can include DVCLive in your training code:
# 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()
After you run your training code, you should see the following content in the project:
$ tree
âââ dvclive
â âââ images
â â âââ img.png
â âââ 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_image()
and Live.log_plot()
for more details.
If and when step
is updated, DVCLive generates or updates an HTML report in
dvclive/report.html
which will contain all the logged data.
If you don't update the step number, the HTML report won't be generated unless
you call Live.make_report()
directly.
Learn how to use DVCLive alongside other tools: