dvclive


Namedvclive JSON
Version 3.48.0 PyPI version JSON
download
home_pageNone
SummaryExperiments logger for ML projects.
upload_time2024-08-05 16:50:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseApache License 2.0
keywords ai metrics collaboration data-science data-version-control developer-tools git machine-learning reproducibility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DVCLive

[![PyPI](https://img.shields.io/pypi/v/dvclive.svg)](https://pypi.org/project/dvclive/)
[![Status](https://img.shields.io/pypi/status/dvclive.svg)](https://pypi.org/project/dvclive/)
[![Python Version](https://img.shields.io/pypi/pyversions/dvclive)](https://pypi.org/project/dvclive)
[![License](https://img.shields.io/pypi/l/dvclive)](https://opensource.org/licenses/Apache-2.0)

[![Tests](https://github.com/iterative/dvclive/workflows/Tests/badge.svg?branch=main)](https://github.com/iterative/dvclive/actions?workflow=Tests)
[![Codecov](https://codecov.io/gh/iterative/dvclive/branch/main/graph/badge.svg)](https://app.codecov.io/gh/iterative/dvclive)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

DVCLive is a Python library for logging machine learning metrics and other
metadata in simple file formats, which is fully compatible with DVC.

# [Documentation](https://dvc.org/doc/dvclive)

- [Get Started](https://dvc.org/doc/start/experiments)
- [How it Works](https://dvc.org/doc/dvclive/how-it-works)
- [API Reference](https://dvc.org/doc/dvclive/live)
- [Integrations](https://dvc.org/doc/dvclive/ml-frameworks)

______________________________________________________________________

# Quickstart

| Python API Overview | PyTorch Lightning | Scikit-learn | Ultralytics YOLO v8 |
|--------|--------|--------|--------|
| <a href="https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-Quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a> | <a href="https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-PyTorch-Lightning.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a> | <a href="https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-scikit-learn.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a> | <a href="https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-YOLO.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" /></a> |

## Install *dvclive*

```console
$ pip install dvclive
```

## Initialize DVC Repository

```console
$ git init
$ dvc init
$ git commit -m "DVC init"
```

## Example code

Copy the snippet below into `train.py` for a basic API usage example:

```python
import time
import random

from dvclive import Live

params = {"learning_rate": 0.002, "optimizer": "Adam", "epochs": 20}

with Live() as live:

    # log a parameters
    for param in params:
        live.log_param(param, params[param])

    # simulate training
    offset = random.uniform(0.2, 0.1)
    for epoch in range(1, params["epochs"]):
        fuzz = random.uniform(0.01, 0.1)
        accuracy = 1 - (2 ** - epoch) - fuzz - offset
        loss = (2 ** - epoch) + fuzz + offset

        # log metrics to studio
        live.log_metric("accuracy", accuracy)
        live.log_metric("loss", loss)
        live.next_step()
        time.sleep(0.2)
```

See [Integrations](https://dvc.org/doc/dvclive/ml-frameworks) for examples using
DVCLive alongside different ML Frameworks.

## Running

Run this a couple of times to simulate multiple experiments:

```console
$ python train.py
$ python train.py
$ python train.py
...
```

## Comparing

DVCLive outputs can be rendered in different ways:

### DVC CLI

You can use [dvc exp show](https://dvc.org/doc/command-reference/exp/show) and
[dvc plots](https://dvc.org/doc/command-reference/plots) to compare and
visualize metrics, parameters and plots across experiments:

```console
$ dvc exp show
```

```
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
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
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
```

```console
$ dvc plots diff $(dvc exp list --names-only) --open
```

![dvc plots diff](./docs/dvc_plots_diff.png)

### DVC Extension for VS Code

Inside the
[DVC Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=Iterative.dvc),
you can compare and visualize results using the
[Experiments](https://github.com/iterative/vscode-dvc/blob/main/extension/resources/walkthrough/experiments-table.md)
and
[Plots](https://github.com/iterative/vscode-dvc/blob/main/extension/resources/walkthrough/plots.md)
views:

![VSCode Experiments](./docs/vscode_experiments.png)

![VSCode Plots](./docs/vscode_plots.png)

While experiments are running, live updates will be displayed in both views.

### DVC Studio

If you push the results to [DVC Studio](https://dvc.org/doc/studio), you can
compare experiments against the entire repo history:

![Studio Compare](./docs/studio_compare.png)

You can enable
[Studio Live Experiments](https://dvc.org/doc/studio/user-guide/projects-and-experiments/live-metrics-and-plots)
to see live updates while experiments are running.

______________________________________________________________________

# Comparison to related technologies

**DVCLive** is an *ML Logger*, similar to:

- [MLFlow](https://mlflow.org/)
- [Weights & Biases](https://wandb.ai/site)
- [Neptune](https://neptune.ai/)

The main differences with those *ML Loggers* are:

- **DVCLive** does not **require** any additional services or servers to run.
- **DVCLive** metrics, parameters, and plots are
  [stored as plain text files](https://dvc.org/doc/dvclive/how-it-works#directory-structure)
  that can be versioned by tools like Git or tracked as pointers to files in DVC
  storage.
- **DVCLive** can save experiments or runs as
  [hidden Git commits](https://dvc.org/doc/dvclive/how-it-works#track-the-results).

You can then use different [options](#comparing) to visualize the metrics,
parameters, and plots across experiments.

______________________________________________________________________

# Contributing

Contributions are very welcome. To learn more, see the
[Contributor Guide](CONTRIBUTING.rst).

# License

Distributed under the terms of the
[Apache 2.0 license](https://opensource.org/licenses/Apache-2.0), *dvclive* is
free and open source software.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dvclive",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Iterative <support@dvc.org>",
    "keywords": "ai, metrics, collaboration, data-science, data-version-control, developer-tools, git, machine-learning, reproducibility",
    "author": null,
    "author_email": "Iterative <support@dvc.org>",
    "download_url": "https://files.pythonhosted.org/packages/e3/91/d6cf2ccceaa063b988809ab4fa33846e6ee811ef146b573dadc1c9fb0a0f/dvclive-3.48.0.tar.gz",
    "platform": "any",
    "description": "# DVCLive\n\n[![PyPI](https://img.shields.io/pypi/v/dvclive.svg)](https://pypi.org/project/dvclive/)\n[![Status](https://img.shields.io/pypi/status/dvclive.svg)](https://pypi.org/project/dvclive/)\n[![Python Version](https://img.shields.io/pypi/pyversions/dvclive)](https://pypi.org/project/dvclive)\n[![License](https://img.shields.io/pypi/l/dvclive)](https://opensource.org/licenses/Apache-2.0)\n\n[![Tests](https://github.com/iterative/dvclive/workflows/Tests/badge.svg?branch=main)](https://github.com/iterative/dvclive/actions?workflow=Tests)\n[![Codecov](https://codecov.io/gh/iterative/dvclive/branch/main/graph/badge.svg)](https://app.codecov.io/gh/iterative/dvclive)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nDVCLive is a Python library for logging machine learning metrics and other\nmetadata in simple file formats, which is fully compatible with DVC.\n\n# [Documentation](https://dvc.org/doc/dvclive)\n\n- [Get Started](https://dvc.org/doc/start/experiments)\n- [How it Works](https://dvc.org/doc/dvclive/how-it-works)\n- [API Reference](https://dvc.org/doc/dvclive/live)\n- [Integrations](https://dvc.org/doc/dvclive/ml-frameworks)\n\n______________________________________________________________________\n\n# Quickstart\n\n| Python API Overview | PyTorch Lightning | Scikit-learn | Ultralytics YOLO v8 |\n|--------|--------|--------|--------|\n| <a href=\"https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-Quickstart.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" /></a> | <a href=\"https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-PyTorch-Lightning.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" /></a> | <a href=\"https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-scikit-learn.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" /></a> | <a href=\"https://colab.research.google.com/github/iterative/dvclive/blob/main/examples/DVCLive-YOLO.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" /></a> |\n\n## Install *dvclive*\n\n```console\n$ pip install dvclive\n```\n\n## Initialize DVC Repository\n\n```console\n$ git init\n$ dvc init\n$ git commit -m \"DVC init\"\n```\n\n## Example code\n\nCopy the snippet below into `train.py` for a basic API usage example:\n\n```python\nimport time\nimport random\n\nfrom dvclive import Live\n\nparams = {\"learning_rate\": 0.002, \"optimizer\": \"Adam\", \"epochs\": 20}\n\nwith Live() as live:\n\n    # log a parameters\n    for param in params:\n        live.log_param(param, params[param])\n\n    # simulate training\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 to studio\n        live.log_metric(\"accuracy\", accuracy)\n        live.log_metric(\"loss\", loss)\n        live.next_step()\n        time.sleep(0.2)\n```\n\nSee [Integrations](https://dvc.org/doc/dvclive/ml-frameworks) for examples using\nDVCLive alongside different ML Frameworks.\n\n## Running\n\nRun this a couple of times to simulate multiple experiments:\n\n```console\n$ python train.py\n$ python train.py\n$ python train.py\n...\n```\n\n## Comparing\n\nDVCLive outputs can be rendered in different ways:\n\n### DVC CLI\n\nYou can use [dvc exp show](https://dvc.org/doc/command-reference/exp/show) and\n[dvc plots](https://dvc.org/doc/command-reference/plots) to compare and\nvisualize metrics, parameters and plots across experiments:\n\n```console\n$ dvc exp show\n```\n\n```\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nExperiment                 Created    train.accuracy   train.loss   val.accuracy   val.loss   step   epochs\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nworkspace                  -                  6.0109      0.23311          6.062    0.24321      6   7\nmaster                     08:50 PM                -            -              -          -      -   -\n\u251c\u2500\u2500 4475845 [aulic-chiv]   08:56 PM           6.0109      0.23311          6.062    0.24321      6   7\n\u251c\u2500\u2500 7d4cef7 [yarer-tods]   08:56 PM           4.8551      0.82012         4.5555   0.033533      4   5\n\u2514\u2500\u2500 d503f8e [curst-chad]   08:56 PM           4.9768     0.070585         4.0773    0.46639      4   5\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n```\n\n```console\n$ dvc plots diff $(dvc exp list --names-only) --open\n```\n\n![dvc plots diff](./docs/dvc_plots_diff.png)\n\n### DVC Extension for VS Code\n\nInside the\n[DVC Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=Iterative.dvc),\nyou can compare and visualize results using the\n[Experiments](https://github.com/iterative/vscode-dvc/blob/main/extension/resources/walkthrough/experiments-table.md)\nand\n[Plots](https://github.com/iterative/vscode-dvc/blob/main/extension/resources/walkthrough/plots.md)\nviews:\n\n![VSCode Experiments](./docs/vscode_experiments.png)\n\n![VSCode Plots](./docs/vscode_plots.png)\n\nWhile experiments are running, live updates will be displayed in both views.\n\n### DVC Studio\n\nIf you push the results to [DVC Studio](https://dvc.org/doc/studio), you can\ncompare experiments against the entire repo history:\n\n![Studio Compare](./docs/studio_compare.png)\n\nYou can enable\n[Studio Live Experiments](https://dvc.org/doc/studio/user-guide/projects-and-experiments/live-metrics-and-plots)\nto see live updates while experiments are running.\n\n______________________________________________________________________\n\n# Comparison to related technologies\n\n**DVCLive** is an *ML Logger*, similar to:\n\n- [MLFlow](https://mlflow.org/)\n- [Weights & Biases](https://wandb.ai/site)\n- [Neptune](https://neptune.ai/)\n\nThe main differences with those *ML Loggers* are:\n\n- **DVCLive** does not **require** any additional services or servers to run.\n- **DVCLive** metrics, parameters, and plots are\n  [stored as plain text files](https://dvc.org/doc/dvclive/how-it-works#directory-structure)\n  that can be versioned by tools like Git or tracked as pointers to files in DVC\n  storage.\n- **DVCLive** can save experiments or runs as\n  [hidden Git commits](https://dvc.org/doc/dvclive/how-it-works#track-the-results).\n\nYou can then use different [options](#comparing) to visualize the metrics,\nparameters, and plots across experiments.\n\n______________________________________________________________________\n\n# Contributing\n\nContributions are very welcome. To learn more, see the\n[Contributor Guide](CONTRIBUTING.rst).\n\n# License\n\nDistributed under the terms of the\n[Apache 2.0 license](https://opensource.org/licenses/Apache-2.0), *dvclive* is\nfree and open source software.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Experiments logger for ML projects.",
    "version": "3.48.0",
    "project_urls": {
        "Changelog": "https://github.com/iterative/dvclive/releases",
        "Documentation": "https://dvc.org/doc/dvclive",
        "Homepage": "https://github.com/iterative/dvclive",
        "Issues": "https://github.com/iterative/dvclive/issues",
        "Repository": "https://github.com/iterative/dvclive"
    },
    "split_keywords": [
        "ai",
        " metrics",
        " collaboration",
        " data-science",
        " data-version-control",
        " developer-tools",
        " git",
        " machine-learning",
        " reproducibility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df8696f6a2383e94b90b97b7920c4a1831a8858a5bfd1a08ac3bd8e2626e7bd1",
                "md5": "702beeffe609317b257dd4f38a805c79",
                "sha256": "6625b9eac49322165877a95696db8934d190d89fadf53294c471d2584b322879"
            },
            "downloads": -1,
            "filename": "dvclive-3.48.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "702beeffe609317b257dd4f38a805c79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 43481,
            "upload_time": "2024-08-05T16:50:23",
            "upload_time_iso_8601": "2024-08-05T16:50:23.137811Z",
            "url": "https://files.pythonhosted.org/packages/df/86/96f6a2383e94b90b97b7920c4a1831a8858a5bfd1a08ac3bd8e2626e7bd1/dvclive-3.48.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e391d6cf2ccceaa063b988809ab4fa33846e6ee811ef146b573dadc1c9fb0a0f",
                "md5": "85e39ede60469eb3c7a968b040de3e3e",
                "sha256": "42434660f16b88c8931e625da010c9cdabf2b0d8d11173b81ed1d976c4b7fb0a"
            },
            "downloads": -1,
            "filename": "dvclive-3.48.0.tar.gz",
            "has_sig": false,
            "md5_digest": "85e39ede60469eb3c7a968b040de3e3e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 2041796,
            "upload_time": "2024-08-05T16:50:25",
            "upload_time_iso_8601": "2024-08-05T16:50:25.350946Z",
            "url": "https://files.pythonhosted.org/packages/e3/91/d6cf2ccceaa063b988809ab4fa33846e6ee811ef146b573dadc1c9fb0a0f/dvclive-3.48.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-05 16:50:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iterative",
    "github_project": "dvclive",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dvclive"
}
        
Elapsed time: 0.61641s