Tutorial DVC
DVC tutorial on data version control: tracking data with Git, remotes, pipelines, parameters and metrics, experiments, collaboration, CI and projects.
Getting Started
- What Is DVC? Data Version Control Explained Learn what DVC is, why Git alone struggles with large datasets and models, who this tutorial is for, what it can run, and how the whole course is organized.
- Install DVC and Initialize a Project Install DVC with pip, pipx or conda, add the storage extras you need, run dvc init in a Git repository and learn what each new file does.
- How DVC Works: Hashes, Cache and Links Understand the DVC cache: content hashes, how files and directories are stored, why identical data is saved once, and how reflinks, hardlinks and copies differ.
Versioning Data
- Track Data with dvc add Use dvc add to track files and folders, read the .dvc file it writes, commit it with Git, update data safely, and skip unwanted files with a .dvcignore file.
- Switch Between Data Versions with checkout Restore old datasets with git checkout and dvc checkout, compare revisions with dvc diff, inspect your workspace with dvc data status and fix missing files.
Remote Storage
- DVC Remotes: Share Data with push and pull Set up a DVC remote, choose a default, upload and download data with push, pull and fetch, check what is missing with status, and avoid broken team history.
- Cloud and SSH Remotes: Setup and Credentials Configure DVC remotes on Amazon S3, S3-compatible services, Google Cloud Storage, Azure Blob and SSH, and keep secrets out of Git with local configuration.
- Import and Reuse Data from Other DVC Projects Reuse datasets across projects with dvc list, get, import and update, track external URLs with import-url, and read versioned files with the DVC Python API.
Pipelines
- Build Your First DVC Pipeline Turn scripts into a DVC pipeline with dvc stage add and dvc.yaml: define commands, dependencies and outputs, link stages into a graph and view it with dvc dag.
- Reproduce Pipelines with dvc repro and dvc.lock Learn how dvc repro decides which stages to run, what dvc.lock records, how the run cache restores old results, and which flags control a pipeline run.
- DVC Templating, foreach and matrix Stages Avoid copy-paste in dvc.yaml using templating variables, vars, foreach loops and matrix stages, learn how generated stage names work and how to run them.
- Advanced DVC Stage Options and External Data Control DVC stages with cache, persist, push and remote output settings, wdir, frozen and always_changed, and depend on data that lives outside your project.
Parameters, Metrics and Plots
- DVC Parameters and params.yaml Store settings in params.yaml, declare them as stage parameters so DVC reruns only when needed, read them in Python and compare values with dvc params diff.
- DVC Metrics: Record and Compare Results Save model and data quality numbers in metrics files, register them in dvc.yaml, compare versions with dvc metrics show and diff, and avoid misleading scores.
- DVC Plots: Visualize and Compare Curves Define DVC plots in dvc.yaml from CSV, JSON or image files, choose templates, render HTML reports with dvc plots show and compare versions with plots diff.
Experiments
- Run DVC Experiments with dvc exp run Run DVC experiments without cluttering Git history: change parameters with set-param, name runs, use temp mode, save manual results and know what gets stored.
- Compare, Apply and Share DVC Experiments Compare DVC experiments with exp show and exp diff, restore a winner with exp apply or exp branch, share runs with exp push and pull, and clean up old ones.
- DVC Experiment Queues, Grid Search and Hydra Queue many DVC experiments, sweep parameter values with Hydra syntax, run workers in parallel with dvc queue, and compose configurations with Hydra support.
- DVCLive: Log Metrics from Training Code Use DVCLive to log parameters, metrics, plot data and model artifacts from Python training code, manage steps, and connect logged runs to DVC experiments.
Collaboration and CI
- Team Workflow: Git Hooks, Branches and Merges Work together with DVC: onboard teammates, install Git hooks, review data changes in pull requests and resolve conflicts in dvc.yaml, dvc.lock and .dvc files.
- Run DVC in CI/CD Pipelines Check pipelines and data in CI: install DVC in GitHub Actions with setup-dvc, pull data safely with secrets, verify pushes, reproduce stages and post metrics.
Troubleshooting and Practices
- Troubleshooting Common DVC Problems Fix common DVC problems: failed pulls, missing cache objects, lock errors, too many open files, credentials, stale pipelines and Git-tracked data, step by step.
- Clean DVC Storage Safely and Best Practices Reclaim space with dvc gc without losing history, share a cache safely, structure DVC projects well and follow practical rules for security and reproducibility.
Projects and Reference
- Project: Build a Versioned Dataset with DVC A hands-on DVC project: create a small dataset, track two versions, add a local remote, tag releases, roll back safely and validate data before publishing.
- Project: A Reproducible Training Pipeline Build a DVC pipeline with prepare, train and evaluate stages, parameters and metrics, run experiments, pick a winner and add checks you can use in CI.
- DVC Glossary and Command Cheat Sheet A quick DVC reference: plain-language glossary, command cheat sheet for tracking, remotes, pipelines and experiments, file overview and a daily routine.