Live()
Initializes a DVCLive logger.
class Live:
def __init__(
self,
dir: str = "dvclive",
resume: bool = False,
report: Literal["md", "notebook", "html", None] = None,
save_dvc_exp: bool = True,
dvcyaml: Optional[str] = "dvc.yaml",
cache_images: bool = False,
exp_name: Optional[str] = None,
exp_message: Optional[str] = None,
monitor_system: bool = False,
):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- path fordvc.yamlfile. -
metrics_file-{Live.dir}/metrics.json. -
params_file-{Live.dir}/params.yaml. -
plots_dir-{Live.dir}/plots. -
report_file-{Live.dir}/report.{format}. Theformatcan be HTML (.html) or Markdown (.md) depending on the value of thereportparameter.
Parameters
-
dir- where to save DVCLive's outputs. Defaults todvclive. -
resume- ifTrue, DVCLive will try to read the previousstepfrom themetrics_fileand start from that point. Defaults toFalse. -
report- any ofhtml,notebook,mdorNone. SeeLive.make_report(). Defaults toNone. -
save_dvc_exp- ifTrue, DVCLive will create a new DVC experiment as part ofLive.end(). Defaults toTrue.If you are using DVCLive inside a DVC Pipeline and running with
dvc exp run, the option will be ignored. -
dvcyaml- where to writedvc.yamlfile, which adds DVC configuration for metrics, plots, and parameters as part ofLive.next_step()andLive.end(). IfNone, nodvc.yamlfile is written. Defaults todvc.yaml. SeeLive.make_dvcyaml().If a string like
subdir/dvc.yaml, DVCLive will write the configuration to that path (file must be nameddvc.yaml).If
False, DVCLive will not write todvc.yaml(useful if you are tracking DVCLive metrics, plots, and parameters independently and want to avoid duplication). -
cache_images- ifTrue, DVCLive will cache any images logged withLive.log_image()as part ofLive.end(). Defaults toFalse.If running a DVC pipeline,
cache_imageswill be ignored, and you should instead cache images as pipeline outputs. -
exp_name- if notNone, andsave_dvc_expisTrue, the provided string will be passed todvc exp save --name.If DVCLive is used inside
dvc exp run, the option will be ignored, usedvc exp run --nameinstead. -
exp_message- if notNone, andsave_dvc_expisTrue, 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 --messageinstead. -
monitor_system- ifTrue, DVCLive will log system metrics, including GPU, CPU, RAM, and disk usage. Defaults toFalse.