Package: dvclive
DVCLiveDVCLive is a Python library for logging machine learning metrics and other
metadata in simple file formats, which is fully compatible with DVC.DocumentationGet StartedHow it WorksAPI ReferenceIntegrationsQuickstartPython API OverviewPyTorch LightningScikit-learnUltralytics YOLO v8Installdvclive$pipinstalldvcliveInitialize DVC Repository$gitinit$dvcinit$gitcommit-m"DVC init"Example codeCopy the snippet below intotrain.pyfor a basic API usage example:importtimeimportrandomfromdvcliveimportLiveparams={"learning_rate":0.002,"optimizer":"Adam","epochs":20}withLive()aslive:# log a parametersforparaminparams:live.log_param(param,params[param])# simulate trainingoffset=random.uniform(0.2,0.1)forepochinrange(1,params["epochs"]):fuzz=random.uniform(0.01,0.1)accuracy=1-(2**-epoch)-fuzz-offsetloss=(2**-epoch)+fuzz+offset# log metrics to studiolive.log_metric("accuracy",accuracy)live.log_metric("loss",loss)live.next_step()time.sleep(0.2)SeeIntegrationsfor examples using
DVCLive alongside different ML Frameworks.RunningRun this a couple of times to simulate multiple experiments:$pythontrain.py$pythontrain.py$pythontrain.py...ComparingDVCLive outputs can be rendered in different ways:DVC CLIYou can usedvc exp showanddvc plotsto compare and
visualize metrics, parameters and plots across experiments:$dvcexpshow─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Experiment                 Created    train.accuracy   train.loss   val.accuracy   val.loss   step   epochs
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
workspace                  -                  6.0109      0.23311          6.062    0.24321      6   7
master                     08:50 PM                -            -              -          -      -   -
├── 4475845 [aulic-chiv]   08:56 PM           6.0109      0.23311          6.062    0.24321      6   7
├── 7d4cef7 [yarer-tods]   08:56 PM           4.8551      0.82012         4.5555   0.033533      4   5
└── d503f8e [curst-chad]   08:56 PM           4.9768     0.070585         4.0773    0.46639      4   5
─────────────────────────────────────────────────────────────────────────────────────────────────────────────$dvcplotsdiff$(dvcexplist--names-only)--openDVC Extension for VS CodeInside theDVC Extension for VS Code,
you can compare and visualize results using theExperimentsandPlotsviews:While experiments are running, live updates will be displayed in both views.DVC StudioIf you push the results toDVC Studio, you can
compare experiments against the entire repo history:You can enableStudio Live Experimentsto see live updates while experiments are running.Comparison to related technologiesDVCLiveis anML Logger, similar to:MLFlowWeights & BiasesNeptuneThe main differences with thoseML Loggersare:DVCLivedoes notrequireany additional services or servers to run.DVCLivemetrics, parameters, and plots arestored as plain text filesthat can be versioned by tools like Git or tracked as pointers to files in DVC
storage.DVCLivecan save experiments or runs ashidden Git commits.You can then use differentoptionsto visualize the metrics,
parameters, and plots across experiments.ContributingContributions are very welcome. To learn more, see theContributor Guide.LicenseDistributed under the terms of theApache 2.0 license,dvcliveis
free and open source software.