Git Product home page Git Product logo

dvc's Introduction

DVC logo

WebsiteDocsBlogTutorialRelated TechnologiesHow DVC worksVS Code ExtensionInstallationContributingCommunity and Support

GHA Tests Python Version Codecov DOI

PyPI PyPI Downloads deb|pkg|rpm|exe Homebrew Conda-forge Chocolatey Snapcraft

Data Version Control or DVC is a command line tool and VS Code Extension to help you develop reproducible machine learning projects:

  1. Version your data and models. Store them in your cloud storage but keep their version info in your Git repo.
  2. Iterate fast with lightweight pipelines. When you make changes, only run the steps impacted by those changes.
  3. Track experiments in your local Git repo (no servers needed).
  4. Compare any data, code, parameters, model, or performance plots.
  5. Share experiments and automatically reproduce anyone's experiment.

Quick start

Please read our Command Reference for a complete list.

A common CLI workflow includes:

Task Terminal
Track data
$ git add train.py params.yaml
$ dvc add images/
Connect code and data
$ 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
Make changes and experiment
$ dvc exp run -n exp-baseline
$ vi train.py
$ dvc exp run -n exp-code-change
Compare and select experiments
$ dvc exp show
$ dvc exp apply exp-baseline
Share code
$ git add .
$ git commit -m 'The baseline model'
$ git push
Share data and ML models
$ dvc remote add myremote -d s3://mybucket/image_cnn
$ dvc push

How DVC works

We encourage you to read our Get Started docs to better understand what DVC does and how it can fit your scenarios.

The closest analogies to describe the main DVC features are these:

  1. Git for data: Store and share data artifacts (like Git-LFS but without a server) and models, connecting them with a Git repository. Data management meets GitOps!
  2. Makefiles for ML: Describes how data or model artifacts are built from other data and code in a standard format. Now you can version your data pipelines with Git.
  3. Local experiment tracking: Turn your machine into an ML experiment management platform, and collaborate with others using existing Git hosting (Github, Gitlab, etc.).

Git is employed as usual to store and version code (including DVC meta-files as placeholders for data). DVC stores data and model files seamlessly in a cache outside of Git, while preserving almost the same user experience as if they were in the repo. To share and back up the data cache, DVC supports multiple remote storage platforms - any cloud (S3, Azure, Google Cloud, etc.) or on-premise network storage (via SSH, for example).

how_dvc_works

DVC pipelines (computational graphs) connect code and data together. They specify all steps required to produce a model: input dependencies including code, data, commands to run; and output information to be saved.

Last but not least, DVC Experiment Versioning lets you prepare and run a large number of experiments. Their results can be filtered and compared based on hyperparameters and metrics, and visualized with multiple plots.

VS Code Extension

To use DVC as a GUI right from your VS Code IDE, install the DVC Extension from the Marketplace. It currently features experiment tracking and data management, and more features (data pipeline support, etc.) are coming soon!

DVC Extension for VS Code

Note: You'll have to install core DVC on your system separately (as detailed below). The Extension will guide you if needed.

Installation

There are several ways to install DVC: in VS Code; using snap, choco, brew, conda, pip; or with an OS-specific package. Full instructions are available here.

Snapcraft (Linux)

Snapcraft

snap install dvc --classic

This corresponds to the latest tagged release. Add --beta for the latest tagged release candidate, or --edge for the latest main version.

Chocolatey (Windows)

Chocolatey

choco install dvc

Brew (mac OS)

Homebrew

brew install dvc

Anaconda (Any platform)

Conda-forge

conda install -c conda-forge mamba # installs much faster than conda
mamba install -c conda-forge dvc

Depending on the remote storage type you plan to use to keep and share your data, you might need to install optional dependencies: dvc-s3, dvc-azure, dvc-gdrive, dvc-gs, dvc-oss, dvc-ssh.

PyPI (Python)

PyPI

pip install dvc

Depending on the remote storage type you plan to use to keep and share your data, you might need to specify one of the optional dependencies: s3, gs, azure, oss, ssh. Or all to include them all. The command should look like this: pip install 'dvc[s3]' (in this case AWS S3 dependencies such as boto3 will be installed automatically).

To install the development version, run:

pip install git+git://github.com/iterative/dvc

Package (Platform-specific)

deb|pkg|rpm|exe

Self-contained packages for Linux, Windows, and Mac are available. The latest version of the packages can be found on the GitHub releases page.

Ubuntu / Debian (deb)

sudo wget https://dvc.org/deb/dvc.list -O /etc/apt/sources.list.d/dvc.list
wget -qO - https://dvc.org/deb/iterative.asc | sudo apt-key add -
sudo apt update
sudo apt install dvc

Fedora / CentOS (rpm)

sudo wget https://dvc.org/rpm/dvc.repo -O /etc/yum.repos.d/dvc.repo
sudo rpm --import https://dvc.org/rpm/iterative.asc
sudo yum update
sudo yum install dvc

Contributing

Code Climate

Contributions are welcome! Please see our Contributing Guide for more details. Thanks to all our contributors!

Contributors

Community and Support

Copyright

This project is distributed under the Apache license version 2.0 (see the LICENSE file in the project root).

By submitting a pull request to this project, you agree to license your contribution under the Apache license version 2.0 to this project.

Citation

DOI

Iterative, DVC: Data Version Control - Git for Data & Models (2020) DOI:10.5281/zenodo.012345.

Barrak, A., Eghan, E.E. and Adams, B. On the Co-evolution of ML Pipelines and Source Code - Empirical Study of DVC Projects , in Proceedings of the 28th IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2021. Hawaii, USA.

dvc's People

Contributors

algomaster99 avatar casperdcl avatar daavoo avatar danihodovic avatar dberenbaum avatar dependabot[bot] avatar django-kz avatar dmpetrov avatar dnabanita7 avatar dtrifiro avatar earlh avatar efiop avatar ei-grad avatar fabiosantoscode avatar gvyshnya avatar isidentical avatar jorgeorpinel avatar karajan1001 avatar maxhora avatar maykulkarni avatar nik123 avatar pared avatar pmrowla avatar pre-commit-ci[bot] avatar rlamy avatar sanidhyamangal avatar shcheklein avatar skshetry avatar suor avatar verasativa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dvc's Issues

Do not check cloud credentials

dvc should work out of box without any cloud credentials and error\warning messages.

Currently:

$ dvc run python code/df_to_matrix.py data/Posts-bin-fr-test.tsv data/Posts-test-matrix.p
Error. config 'dvc.conf' is not correctly setup.  Please fix:
Error.     can't find aws credentials.  TODO

Desired behavior:

  • by default, no cloud is set in config "Cloud = ". No checking.
  • if Cloud is set in config - dvc complains only in cloud related commands (sync currently and remove)

Improve logging (simple)

Logging level should depend on log file setting. Only INFO messages by default.
A simple solution is needed - no advanced logging libs for now.

How to share cloud sync in public?

Scenario:
0) I work on DVC project wich is publicly available in Github

  1. I use my private cloud credentials
  2. I sync the data results to a cloud and make the result available for public (how?)
  3. Somebody clone my DVC repository
  4. He also can use my private data from the cloud (how?)
  • Do we need special settings in the stats files?
  • What to do if somebody forks the repository and uses his own credentials for the next iterations.

Check for git snapshot before performing any command

$ dvc repro data/Badges.xml
Debug. [Git] Getting file statuses. Command: git status --porcelain
Debug. [Git] Getting file statuses. Success.
Error. [Git] Commit all changed files before running reproducible command.
Error. [Git] Changed files:
Error.  M dvc.conf

(easy) Import from the clouds

s3 and gcp import are not implemented yet - only files and publicly available urls

Scenario: two guys are working on the same project. The first guy uploads a private dataset to S3 and uses the dataset as data source for a pipeline\workflow. The second guy should be able to reuse the dataset if he has permissions to the dataset.

The same scenario should work in GCP.

Probably not in beta version.

data-sync multiple imports

$ dvc import data/file*

This command imports only the first file it will recognize - file1.txt for example, not file2.txt.

data-sync from different repo

In a dvc repository some of data-files were synced to cloud. Then the repo was cloned.

But I failed to sync the file:

$ dvc data-sync data/summary.txt
Downloading cache file from S3 "nlx-shared/tag_classifier/.cache/summary.txt_6405e23"
Traceback (most recent call last):
  File "/Users/dmitry/src/dvc/dvc2.py", line 77, in <module>
    Runtime.run(CmdDataSync, args_start_loc=argv_offset)
  File "/Users/dmitry/src/dvc/dvc/runtime.py", line 45, in run
    sys.exit(instance.run())
  File "/Users/dmitry/src/dvc/dvc/command/data_sync.py", line 60, in run
    return self.sync_symlink(data_item)
  File "/Users/dmitry/src/dvc/dvc/command/data_sync.py", line 84, in sync_symlink
    self.sync_from_cloud(data_item)
  File "/Users/dmitry/src/dvc/dvc/command/data_sync.py", line 184, in sync_from_cloud
    return self._sync_from_cloud_aws(item)
  File "/Users/dmitry/src/dvc/dvc/command/data_sync.py", line 106, in _sync_from_cloud_aws
    key.get_contents_to_filename(item.resolved_cache.relative, cb=percent_cb)
  File "/usr/local/lib/python2.7/site-packages/boto/s3/key.py", line 1714, in get_contents_to_filename
    os.remove(filename)
OSError: [Errno 2] No such file or directory: '.cache/summary.txt_6405e23'

Names are correct. File exist in the cloud.

Another issue - exception should be caught and outputted as a single line (or two lines).

Add LogLevel param in command line (easy)

We need two types of logs:

  1. console output (by default: info and above)
  2. log output (by default: debug and above)

Both of the values have to be presented in the dvc.conf file. Like

ConsoleLogLevel = Info
LogLevel = Debug
LogFile = dvc.log # what about system log do we need that?

The config log parameter ConsoleLogLevel could be override by command line:
dvc run --verbose debug Rscript plotting.R data/input.csv.

PS: do not forget Windows support.

onboarding configuration help

test on startup and politely help if
1 - no cloud selected;
2 - no StoragePath
2 - aws / no credentials;
3 - gc / no credentials or no project;

Unconfigured git error

Git repository might be created but git might be not configured.
The results of this failure:

  1. .gitignore file was not created.
  2. change was not committed
c:\src\tmp>dvc init
Directories data/, .cache/ and .state/ were created
Error. Git command error (git commit -m DVC init. data dir data, cache dir .cache, state dir .state):
*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <(NULL)>) not allowed

The dependency graph visualizer

It would be great to see the dependency graph for a given data item.

$ dvc visual data/result_scores.tsv

We need to clarify the output details...

Documentation is needed

What documentation format we should choose? Should we host the docs in the github or outside?

Garbage collection (gc) command is needed

Examples:

  • dvc gc - remove everything from the .cache dir not related to the current data files
  • dvc gc data/myfile.txt - remove all caches except the current one
  • dvc gc --nuke - clean up .cache dir. Basicaly it is rm -rf .cache/*.

Not in the beta version, probably.

Import: weird usage message

Weird message:

c:\src\tmp>dvc import
usage: __main__.py [-h] [--no-git-actions] [--lock] [[...]]
__main__.py: error: the following arguments are required:

osx single file executable crashes

if I run ./build_osx.sh, the dvc executable crashes on startup; the relevant message seems to be

./dist/dvc
Traceback (most recent call last):
  File "dvc2.py", line 13, in <module>
    from dvc.command.data_import import CmdDataImport
  File "/private/var/folders/r9/4rd8csvj56s12zg3vdm360ym0000gn/T/pip-build-kSJs7p/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
  File "dvc/command/data_import.py", line 8, in <module>
    from dvc.command.data_sync import sizeof_fmt
  File "/private/var/folders/r9/4rd8csvj56s12zg3vdm360ym0000gn/T/pip-build-kSJs7p/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
  File "dvc/command/data_sync.py", line 6, in <module>
    from google.cloud import storage as gc
  File "/private/var/folders/r9/4rd8csvj56s12zg3vdm360ym0000gn/T/pip-build-kSJs7p/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
  File "site-packages/google/cloud/storage/__init__.py", line 35, in <module>
  File "site-packages/pkg_resources/__init__.py", line 552, in get_distribution
  File "site-packages/pkg_resources/__init__.py", line 426, in get_provider
  File "site-packages/pkg_resources/__init__.py", line 968, in require
  File "site-packages/pkg_resources/__init__.py", line 854, in resolve
pkg_resources.DistributionNotFound: The 'google-cloud-storage' distribution was not found and is required by the application

Probably related to

google/cloud/storage/__init__.py
35:__version__ = get_distribution('google-cloud-storage').version

pip package

Create dvc pip package and a corresponded web page on pypi.python.org.

All the dvc commands (dvc-init, dvc-run) have to be available to users after the package installation.

help command that lists all commands (for discoverability)

>>> dvc --help
Unimplemented or unrecognized command: --help

usage: dvc [--version] [--help] command [<args>]

These are common DVC commands:

start a working area
    init           Initialize dvc over a directory (should already be a git dir).
    run            Run command.
    import         Import file to data directory.
    remove         Remove data item from data directory.

synchronize data between remote and local
    data sync      Synchronize data file with cloud (cloud settings already setup).
-

Windows installer

How to work on Windows without the symlinks?

Should we use cygwin or any other unix tools for win?
How about windows10 ubuntu shell? Can we support only this version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.