{"id":3985,"library":"dvclive","title":"DVCLive","description":"DVCLive is a Python library for logging machine learning metrics and other metadata. It is designed to be fully compatible with DVC (Data Version Control) and stores logged information in simple, human-readable file formats (like .tsv, .json, .yaml) that can be versioned by Git. It provides real-time experiment tracking and integrates with various ML frameworks, helping users maintain reproducible ML workflows. The current version is 3.49.0, and the library is actively developed with frequent releases.","status":"active","version":"3.49.0","language":"en","source_language":"en","source_url":"https://github.com/iterative/dvclive","tags":["MLOps","experiment tracking","metrics","logging","DVC","machine learning","reproducibility"],"install":[{"cmd":"pip install dvclive","lang":"bash","label":"Core library"},{"cmd":"pip install dvclive[sklearn,image,huggingface,lightning,tf,fastai,optuna,xgb,lgbm,mmcv]","lang":"bash","label":"With common ML framework integrations and features"}],"dependencies":[{"reason":"Requires Python 3.9 or newer.","package":"python","optional":false},{"reason":"Optional, but highly recommended for full experiment versioning and visualization capabilities.","package":"dvc","optional":true},{"reason":"Required for `live.log_sklearn_plot()` methods.","package":"scikit-learn","optional":true},{"reason":"Required for `live.log_image()` methods.","package":"Pillow","optional":true},{"reason":"Often used for custom plot generation, though not a direct dependency of `dvclive` itself, `live.log_image` can log matplotlib figures.","package":"matplotlib","optional":true}],"imports":[{"note":"The `dvclive.init()` function was an older pattern. The modern approach is to instantiate and use the `Live` class.","wrong":"import dvclive; dvclive.init()","symbol":"Live","correct":"from dvclive import Live"}],"quickstart":{"code":"import time\nimport random\nfrom dvclive import Live\n\nparams = {\"learning_rate\": 0.002, \"optimizer\": \"Adam\", \"epochs\": 20}\n\nwith Live() as live:\n    # Log parameters\n    for param in params:\n        live.log_param(param, params[param])\n\n    # Simulate training loop\n    offset = random.uniform(0.2, 0.1)\n    for epoch in range(1, params[\"epochs\"]):\n        fuzz = random.uniform(0.01, 0.1)\n        accuracy = 1 - (2 ** -epoch) - fuzz - offset\n        loss = (2 ** -epoch) + fuzz + offset\n\n        # Log metrics for the current step\n        live.log_metric(\"accuracy\", accuracy)\n        live.log_metric(\"loss\", loss)\n        live.next_step()\n        time.sleep(0.05) # Simulate work, shorten for quick demo","lang":"python","description":"This quickstart demonstrates basic logging of parameters and metrics using `dvclive.Live` within a simulated training loop. Metrics and parameters will be saved in the `dvclive` directory, typically as `metrics.json`, `params.yaml`, and time-series `.tsv` files. Running this code multiple times will generate new experiment steps that can be tracked and compared with DVC."},"warnings":[{"fix":"Upgrade DVCLive to version 3.48.3 or newer, or pin `scikit-learn` to a version older than 1.7.","message":"Scikit-learn `probas_pred` argument change (v3.48.3 and `sklearn>=1.7`). Older DVCLive versions with `sklearn` 1.7+ might encounter `TypeError: missing a required argument: 'y_score'` when using `live.log_sklearn_plot()`. DVCLive 3.48.3 fixed this internally, so ensure your `dvclive` is updated if you use newer `sklearn`.","severity":"breaking","affected_versions":"<3.48.3 (with scikit-learn >= 1.7)"},{"fix":"Users relying on Catalyst integration must either pin `dvclive` to a version older than 3.47.0 or migrate their logging setup away from Catalyst's DVCLive callback.","message":"Dropped Catalyst ML framework integration (v3.47.0). Support for the Catalyst ML framework was removed in DVCLive 3.47.0.","severity":"breaking","affected_versions":">=3.47.0"},{"fix":"Always explicitly pass the `matplotlib.figure.Figure` object you intend to log to `live.log_image()` rather than relying on global state.","message":"Matplotlib `Figure` logging behavior change (v3.48.4). Previously, `live.log_image()` with a matplotlib figure might have implicitly logged the most recently active figure. Since 3.48.4, it strictly logs the `matplotlib.figure.Figure` instance explicitly provided as an argument. Make sure to pass the intended figure object.","severity":"gotcha","affected_versions":">=3.48.4"},{"fix":"Configure `dvclive.Live` instances directly in your Python code using its `__init__` parameters. Avoid relying on or defining the `live` section in `dvc.yaml`.","message":"DVC `live` section deprecation in `dvc.yaml` (DVC 3.0 / DVCLive ~3.0). The `live` section for DVCLive configuration in `dvc.yaml` was deprecated and is no longer the primary way to configure DVCLive. Configuration should primarily be done through the Python `Live` API.","severity":"gotcha","affected_versions":"DVCLive versions integrating with DVC 3.0+"},{"fix":"To explicitly save experiments when running within a DVC pipeline, use `dvc exp run` instead of `dvc repro`.","message":"`save_dvc_exp` ignored in `dvc repro`. When `dvclive` runs as part of a `dvc repro` command, the `save_dvc_exp=True` argument to `Live()` is ignored. DVC experiments will not be automatically saved by `dvclive` in this context.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}