Skip to content
Edit on GitHub


Logs the given scalar val associating it with the given name.

 def log(name: str, val: float):


from dvclive import Live

live = Live()

live.log("loss", 0.1)
live.log("acc", 0.9)


On each live.log(name, val) call DVCLive will create or update the name entry in {Live.dir}.json with the corresponding val:

$ cat dvclive.json
  "loss": 0.1,
  "acc": 0.9

The summary {Live.dir}.json is usable by dvc metrics and dvc exp show/dvc exp diff.

Step updates

The first step update (with Live.next_step() or Live.set_step()) will create a metrics history file in {Live.dir}/scalars/{name}.tsv:

timestamp step  loss
1623671484747 0 0.9

Each subsequent call to live.log(name, val) will add a new row to {Live.dir}/scalars/{name}.tsv.

$ tree
├── dvclive
│   └── scalars
│       ├── acc.tsv
│       └── loss.tsv
└── dvclive.json

The metrics history ({Live.dir}/scalars/{name}.tsv) is usable by dvc plots.

If name contains slashes (e.g. train/loss), the required subdirectories will be created and the file will be saved inside the last one (e.g. {Live.dir}/scalars/train/loss.tsv).


  • name - Name of the scalar being logged.

  • val - The value to be logged.


  • dvclive.error.InvalidDataTypeError - thrown if the provided val does not have a supported type.

  • dvclive.error.DataAlreadyLoggedError - thrown if the provided name has already been logged within the same step.


🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

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

Discord Chat