Edit on GitHub


Generates metrics logs (usable by dvc plots) by saving the given name: val pair to a .tsv file.

 def log(name: str, val: float, step: int = None):


import dvclive

dvclive.log("loss", 0.9)


The first call to dvclive.log(name, val) will create a new file in {path}/{name}.tsv including the header and first row.

For example dvclive.log("loss", 0.9) will create {path}/loss.tsv:

timestamp step  loss
1623671484747 0 0.9

Each subsequent call to dvclive.log(name, val) will add a new row to {path}/{name}.tsv.

The created file {path}/{name}.tsv is usable by dvc plots.

๐Ÿ’ก If name contains slashes (i.e. train/loss), the required subfolders will be created and the file will be saved inside the last subfolder (i.e. {path}/train/loss.tsv).

๐Ÿ’ก If you call dvclive.log() without calling dvclive.init() first, dvclive will automatically initialize itself using either default values or environment variables (when used alongside DVC).


  • name - The metrics logs will be saved in {path}/{name}.tsv.
  • val - The value to be added in the name column of a new row.
  • step (None by default) - The value to be added in the step column of a new row. If None, the value of the internal _step property will be used.


  • dvclive.error.DvcLiveError - If the provided val has not supported type.



๐Ÿ› Found an issue? Let us know! Or fix it:

Edit on GitHub

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

Discord Chat