Code Monkey home page Code Monkey logo

example-dvc-experiments's Introduction

Example Project for DVC Experiments

DVC

DVC

This project is a showcase for dvc exp commands to manage large number of experiments. It trains a CNN on Fashion MNIST dataset in Tensorflow.

### Installation Instructions

After installing DVC and cloning the repository, you can run:

virtualenv .venv
. .venv/bin/activate
pip install -r requirements.txt

Retrieve all the required data and model files:

dvc pull

Running Experiments

You can run the experiment defined in the project.

dvc exp run

This new command in DVC 2.0 also allows to change the parameters on the fly with --set-param option.

dvc exp run --set-param model.conv_units=128 

params.yaml defines two parameters to modify with dvc exp run --set-param/-S option. The above command updates params.yaml with conv_units: 128 before running the experiment.

The experiment will produce metrics.json along with a models/model.h5.

You can check the changes in metrics:

dvc exp diff

It's also possible to queue experiments with --queue option and run them all in a single batch with --run-all.

dvc exp run --queue -S model.conv_units=32
dvc exp run --queue -S model.conv_units=64
dvc exp run --queue -S model.conv_units=96

The queued experiments can be run in parallel with --jobs.

dvc exp run --run-all --jobs 2

You can get the summary of experiments with:

dvc exp show

Limit the parameters and metrics to show with --include-params and --include-metrics options, respectively.

By default experiments are given auto-generated names derived from their inputs and environment. It may be easier to review them when you give names with the --name/-n option.

dvc exp run -n my-baseline-experiment

Artifacts produced by experiments are normally not checked out to the repository. If you want to do so, you can use:

dvc exp apply exp-123456

where exp-123456 is the experiment ID you see with dvc exp show.

Then, you can use DVC and Git commands on the artifacts and code as usual.

You can push and pull the code changes related to an experiment with dvc exp push and dvc exp pull respectively. These two commands work with Git remotes and DVC remotes together. Changes in the text files tracked by Git are transferred from/to Git repositories, and binary tracked by DVC are transferred from/to DVC remotes.

You can clean up the unused experiments with:

dvc exp gc --workspace

Parameters

There are two parameters in the project. They are set in params.yaml. models.conv_units defines the number of convolutional units in the model, and train.epochs sets the number of epochs to train the model.

train:
  - epochs: 1
model:
  - conv_units: 16

You can select these parameters in dvc exp show with --include-params.

Metrics

There are two metrics produced by the training stage.

  • loss: Categorical Crosstentropy loss value
  • acc: Categorical Accuracy metrics for the classes.

You can select these metrics in dvc exp show with --include-metrics.

Data Files

The data files used in the project are found in data/images. All of these files are tracked by DVC and should be retrieved using dvc pull from the configured remote.

Contributing

This repository is generated by example-repos-dev. For Pull Requests regarding the fixes, please use that repository.

example-dvc-experiments's People

Contributors

iterative-olivaw avatar

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.