# DVC

> Git-like version control for data, models, and ML experiments

- Category: Training & Fine-Tuning / Experiment Tracking
- Language: Python
- Repository: https://github.com/treeverse/dvc
- Website: https://dvc.org
- Canonical page: https://ai-tldr.dev/tools/dvc/

## In short

DVC (Data Version Control) is a command-line tool and VS Code extension for building reproducible machine learning projects. It lets you version data and models by keeping the large files in cloud or network storage while tracking their version info inside your Git repository. It sits in the Experiment Tracking category of the Training & Fine-Tuning tools and is open-source, written in Python.

## Overview

DVC (Data Version Control) is a command-line tool and VS Code extension for building reproducible machine learning projects. It lets you version data and models by keeping the large files in cloud or network storage while tracking their version info inside your Git repository.

It is built for ML engineers and data science teams who already use Git for code but need a way to track datasets, model files, pipelines, and experiments. Small placeholder meta-files live in Git, and DVC handles moving the actual data to and from a cache and remote storage.

As an experiment-tracking tool, DVC works locally in your existing Git repo with no separate server. You can define pipelines that rerun only the affected steps, run and compare many experiments by their parameters and metrics, and reproduce anyone's run from the same Git history.

## What it does

- Version datasets and model files in cloud or on-prem storage while keeping version info in Git
- Define lightweight ML pipelines that rerun only the steps affected by your changes
- Track experiments locally in your Git repo with no extra servers
- Compare data, code, parameters, models, and performance plots across runs
- Push and pull data to remote storage such as S3, Azure, Google Cloud, or SSH
- Optional VS Code extension to drive DVC from a GUI inside the IDE

## Getting started

Install the DVC CLI, initialize it inside an existing Git repository, then start tracking data and running experiments.

1. Install DVC

   Install the CLI from PyPI with pip. DVC is also available via Homebrew, Conda, Chocolatey, and Snap.

```bash
pip install dvc
```

2. Track a dataset

   Use git for code and dvc add for data. DVC stores the data in its cache and creates a small meta-file you commit to Git.

```bash
git add train.py params.yaml
dvc add images/
```

3. Define pipeline stages

   Connect code and data into a pipeline so DVC knows how outputs are produced from inputs and commands.

```bash
dvc stage add -n featurize -d images/ -o features/ python featurize.py
dvc stage add -n train -d features/ -d train.py -o model.p -M metrics.json python train.py
```

4. Run and compare experiments

   Run experiments, then list and apply the one you want. Push data and models to a remote to share them.

```bash
dvc exp run -n exp-baseline
dvc exp show
dvc remote add myremote -d s3://mybucket/image_cnn
dvc push
```

## When to use it

- Version large training datasets and model files alongside code without bloating the Git repo
- Build reproducible ML pipelines that rerun only the steps impacted by a change
- Track and compare many experiments by hyperparameters and metrics in a local Git repo
- Share data and models with a team via S3, Azure, Google Cloud, or SSH remote storage
