Skip to content

Commit

Permalink
exp init: UX updates (#3430)
Browse files Browse the repository at this point in the history
* document exp init output changes

* Apply suggestions from code review

* Restyled by prettier (#3439)

Co-authored-by: Restyled.io <[email protected]>

* ref: update exp init -i samples
per #3430 (review)

* ref: clarify when `exp init` creates boilerplate struct and
make notes into admonitions
rel. #3430 (review)

* Update content/docs/command-reference/exp/init.md

Co-authored-by: Dave Berenbaum <[email protected]>

* ref: exp init now creates dirs for outs
improves #3430 (review)

* Update content/docs/command-reference/exp/init.md

Co-authored-by: Dave Berenbaum <[email protected]>

Co-authored-by: Jorge Orpinel <[email protected]>
Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Jorge Orpinel Perez <[email protected]>
Co-authored-by: Dave Berenbaum <[email protected]>
  • Loading branch information
6 people authored Jun 14, 2022
1 parent 811e7bd commit 761f723
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions content/docs/command-reference/exp/init.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# exp init

Quickly setup any project to use [DVC Experiments].
Quickly create or prepare any project to use [DVC Experiments].

> Requires a <abbr>DVC repository</abbr>, created with `git init` and
> `dvc init`.
Expand All @@ -18,38 +18,46 @@ usage: dvc exp init [-h] [-q | -v] [--run] [--interactive] [-f]

## Description

`dvc exp init` helps you get started with DVC Experiments quickly. It reduces
boilerplate DVC procedures by creating a `dvc.yaml` file that assumes standard
locations of your input data, <abbr>parameters</abbr>, source code, models,
<abbr>metrics</abbr> and [plots](/doc/command-reference/plots). These locations
can be customized through the [options](#options) below or via
[configuration](/doc/command-reference/config#exp).
This command helps you get started with DVC Experiments quickly. It reduces
repetitive DVC procedures by creating a necessary `dvc.yaml` file, which assumes
standard locations of your inputs (data, <abbr>parameters</abbr>, and source
code) and outputs (models, <abbr>metrics</abbr>, and
[plots](/doc/command-reference/plots)).

Repository structure assumed by default:
These locations can be customized through the [command options](#options) or via
[configuration](/doc/command-reference/config#exp). Default project structure:

```
β”œβ”€β”€ data/
β”œβ”€β”€ metrics.json
β”œβ”€β”€ models/
β”œβ”€β”€ params.yaml # required
β”œβ”€β”€ params.yaml
β”œβ”€β”€ plots/
└── src/
```

> Note that `dvc exp init` expects at least a `params.yaml` file present. DVC
> reads it to find parameters to include in the [stage definition]. It can
> however be omitted when using the `--explicit` and/or `-i` flags.
You must always provide a command that runs your experiment(s). It can be given
either directly [as an argument](#the-command-argument), or by using the
`--interactive` (`-i`) mode which will prompt you for it. This command will be
The only required argument is the terminal command that runs your experiment(s).
It can be provided directly [as an argument](#the-command-argument) or by using
the `--interactive` (`-i`) mode (which will prompt for it). The command will be
wrapped as a <abbr>stage</abbr> that `dvc exp run` can execute.

Different types of stages are supported, such as `dl` (deep learning) which uses
[DVCLive](/doc/dvclive) to monitor [checkpoints] during training of ML models.
<admon type="tip">

A special `--type` of stage is supported (`checkpoint`), which monitors
[checkpoints] during training of ML models.

</admon>

`dvc exp init` also generates the boilerplate project structure, including input
files/directories and directories needed for future outputs, or any locations
determined in interactive mode.

> `dvc exp init` is intended as a quick way to start running [DVC Experiments].
> See the `dvc.yaml` specification for complex data pipelines.
<admon type="info">

`dvc exp init` is intended as a quick way to start running [DVC Experiments].
See the `dvc.yaml` specification for more complex data pipelines.

</admon>

[stage definition]:
/doc/user-guide/project-structure/pipelines-files#stage-entries
Expand Down Expand Up @@ -107,9 +115,6 @@ $ dvc exp init './another_script.sh $MYENVVAR'
</abbr>parameters</abbr> that your experiment depends on can be found.
Overrides other configuration and default value (`params.yaml`).

> Note that `dvc exp init` will fail if the params file does not exist. This
> is because DVC reads it to find params to include in the [stage definition].
- `--data` - set the path to the data file or directory that your experiment
depends on can be found (if any). Overrides other configuration and default
value (`data/`).
Expand Down Expand Up @@ -153,26 +158,24 @@ The easiest route is using interactive mode and answering a few questions:

```dvc
$ dvc exp init --interactive
This command will guide you to set up a train stage in dvc.yaml...
Command to execute: python src/train.py
Enter the paths for dependencies and outputs of the command.
DVC assumes the following workspace structure:
β”œβ”€β”€ data
β”œβ”€β”€ metrics.json
β”œβ”€β”€ models
β”œβ”€β”€ params.yaml
β”œβ”€β”€ plots
└── src
Enter experiment dependencies.
Path to a code file/directory [src, n to omit]: src/train.py
Path to a data file/directory [data, n to omit]: data/features
Path to a model file/directory [models, n to omit]: models/predict.h5
Path to a parameters file [params.yaml, n to omit]:
Enter experiment outputs.
Path to a model file/directory [models, n to omit]: models/predict.h5
Path to a metrics file [metrics.json, n to omit]:
Path to a plots file/directory [plots, n to omit]: n
...
Creating dependencies: src/train.py and params.yaml
Creating output directories: models
Creating train stage in dvc.yaml
Ensure your experiment command creates metrics.json and models/predict.h5.
You can now run your experiment using "dvc exp run".
```

In this example the code, data, and model locations were specified above to
Expand All @@ -190,7 +193,7 @@ train:
- data/features
- src/train.py
params:
- epochs
- params.yaml:
outs:
- models/predict.h5
metrics:
Expand Down

0 comments on commit 761f723

Please sign in to comment.