Skip to content
Edit on GitHub

dvclive.set_step()

Signals that the current step has ended and sets step to the given value.

def set_step(step: int):

Usage

from dvclive import Live

live = Live()

for step in [0, 10, 20]:
    live.set_step(step)
    live.log("metric_1", 0.9)
    live.log("metric_2", 0.7)

Description

DVCLive uses step to track the progress of the data logged with Live.log() and/or Live.log_image().

You can use Live.set_step() to set step to any value.

Each metric logged in between Live.set_step() (or Live.next_step()) calls will be associated to the provided step value.

Each Live.set_step() will call Live.make_report() internally by default (unless report=None is passed to Live()).

DVC integration

When dvclive is used alongside DVC, each Live.set_step() call will have additional effects.

When checkpoints are enabled in the pipeline, DVC will create a new checkpoint on each Live.set_step() call.

Example

Given the Usage code snippet above, the metrics history generated for metric_1 would be:

$ cat dvclive/metric_1.tsv
timestamp	step	metric_1
1614129197192	0	0.9
1614129198031   10	0.9
1614129198848	20	0.9
Content

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

Edit on GitHub

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

Discord Chat