Live()
Initializes a DVCLive logger.
class Live:
def __init__(
self,
dir: str = "dvclive",
resume: bool = False,
report: Optional[str] = "auto",
save_dvc_exp: bool = False,
dvcyaml: bool = True,
exp_message: Optional[str] = None,
):
Usage
from dvclive import Live
with Live() as live:
...
Description
A Live()
instance is required in order to log machine learning parameters,
metrics and other metadata.
Live()
will remove all existing DVCLive related files under dir
unless
resume=True
.
You can use Live()
as a context manager. When exiting the context manager,
Live.end()
will be called.
Properties
-
step
- SeeLive.next_step()
. -
summary
- SeeLive.make_summary()
. -
dir
- Location of the directory to store outputs. -
dvc_file
-{Live.dir}/dvc.yaml
. -
metrics_file
-{Live.dir}/metrics.json
. -
params_file
-{Live.dir}/params.yaml
. -
plots_dir
-{Live.dir}/plots
. -
report_file
-{Live.dir}/report.{format}
. Theformat
can be HTML (.html
) or Markdown (.md
) depending on the value of thereport
parameter.
Parameters
-
dir
- Where to save DVCLive's outputs. Defaults todvclive
. -
resume
- IfTrue
, DVCLive will try to read the previousstep
from themetrics_file
and start from that point. Defaults toFalse
. -
report
- Any ofauto
,html
,notebook
,md
orNone
. SeeLive.make_report()
.The
auto
mode (default) will usemd
format if theCI
env var is present and matplotlib is installed andhtml
otherwise.If
report
isNone
,Live.make_report()
won't generate anything. -
save_dvc_exp
- IfTrue
, DVCLive will create a new DVC experiment as part ofLive.end()
. Defaults toFalse
. -
dvcyaml
- IfTrue
, DVCLive will write DVC configuration for metrics, plots, and parameters toLive.dvc_file
as part ofLive.next_step()
andLive.end()
. SeeLive.make_dvcyaml()
. Defaults toTrue
.If you are already tracking DVCLive metrics, plots, and parameters in your own
dvc.yaml
file, setdvcyaml=False
to avoid duplication. -
exp_message
- If notNone
, andsave_dvc_exp
isTrue
, the provided string will be passed todvc exp save --message
.If DVCLive is used inside
dvc exp run
, the option will be ignored, usedvc exp run --message
instead.