- https://medium.com/qonto-way/using-dvc-to-create-an-efficient-version-control-system-for-data-projects-96efd94355fe
- Type: tutorial
- Source: Medium (The Qonto Way) · Basile Guerrapin · Jul 2019
TL;DR
Dvc adds a Git-like layer that versions data files through small pointer files and models a project as stages and pipelines tied to the code that produced each result.
Summary
Training data of several gigabytes cannot live in Git, and keeping zips plus a metrics spreadsheet breaks as projects grow: nobody knows which data produced which result. DVC stores pointers (.dvc files with checksums) in Git while the files go to a local cache and a remote such as S3. Each processing step becomes a stage with dependencies, outputs and metrics; dvc status shows what is stale, and git checkout plus dvc checkout restores any past state. The example is VAT detection from receipts.
Key takeaways
- Track data with pointers:
dvc add data/fileignores the file in Git and creates a small versioned.dvcpointer. - Define stages:
dvc run -d <deps> -o <outputs> -M <metrics> -f stage.dvc python script.py. - Chain stages into pipelines where one stage’s outputs feed the next;
dvc statusflags what to rerun. - Restore any state with
git checkout <rev>thendvc checkout. - Sync with remote storage (S3 here) via
dvc pushanddvc pull; rundvc gcto prune the cache only after pushing. - Mind the limit: DVC does not see code changes unless code is a dependency, so the team used a Makefile and
--ignore-build-cacherather thandvc repro.
Tools and concepts
| Item | Role in the page |
|---|---|
| Dvc | Data and pipeline versioning |
| Git | Versions the pointers and stage files |
| S3 | Remote storage for data and models |
| Makefile | Wraps long dvc run commands |
When to use
- When versioning large data files alongside code.
- When you need to reproduce an old experiment with matching data.
- When comparing DVC with
git-lfs.
Caveats
- 2019 CLI (
dvc run) has since been replaced bydvc stage addanddvc.yaml; check current docs.
Dvc Git MLOps S3 Continuous Delivery for Machine Learning A CD4ML Example Setup on AWS S3, GitLab with DVC Git Custom References for ML Experiments