Skip to content

Commit

Permalink
ref: bring changes from #2909
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeorpinel committed Dec 10, 2021
1 parent 0b94a71 commit 9ec36f2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 45 deletions.
26 changes: 15 additions & 11 deletions content/docs/command-reference/exp/apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@ positional arguments:
## Description

Restores an `experiment` into the workspace as long as no more Git commits have
been made after the target experiment (`HEAD` hasn't moved). The `experiment`
can be referenced by name or hash (see `dvc exp run` for details). This changes
any files (code, data, <abbr>parameters</abbr>, <abbr>metrics</abbr>, etc.)
needed to reflect the experiment conditions and results in the workspace.
been made after the target experiment (`HEAD` hasn't moved). The experiment can
be referenced by name or hash (see `dvc exp run` for details).

⚠️ Conflicting changes in the workspace are overwritten unless `--no-force` is
used.
Specifically, `dvc exp apply` changes any files (code, data,
<abbr>parameters</abbr>, <abbr>metrics</abbr>, etc.) needed to reflect the
experiment conditions and results in the workspace. Current changes to the
workspace are preserved except if they conflict with the experiment in question.

⚠️ Conflicting changes in the workspace are overwritten unless unless
`--no-force` is used.

This is typically used after choosing a target `experiment` with `dvc exp show`
or `dvc exp diff`, and before committing it to Git (making it
[persistent](/doc/user-guide/experiment-management#persistent-experiments)).
or `dvc exp diff`, and before committing it to Git (making it [persistent].

> Note that if a history of [checkpoints] is found in the `experiment`, it will
> **not** be preserved when applying and committing it.
Note that the history of
[checkpoints](/doc/command-reference/exp/run#checkpoints) found in the
`experiment` is **not** preserved when applying and committing it.
[persistent]: /doc/user-guide/experiment-management/persisting-experiments
[checkpoints]: /doc/user-guide/experiment-management/checkpoints

## Options

Expand Down
20 changes: 11 additions & 9 deletions content/docs/command-reference/exp/branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@ positional arguments:

## Description

Makes a named Git
[`branch`](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
containing the target `experiment` (making it
[persistent](/doc/user-guide/experiment-management#persistent-experiments)). For
[checkpoint experiments](/doc/command-reference/exp/run#checkpoints), the new
branch will contain multiple commits (the checkpoints).
Makes a named Git [`branch`] containing the target `experiment` (making it
[persistent]. For [checkpoint experiments], the new branch will contain multiple
commits (the checkpoints).

The new `branch` will be based on the experiment's parent commit (`HEAD` at the
time that the experiment was run). Note that DVC **does not** switch into the
new `branch` automatically.

`dvc exp branch` is useful to make an experiment persistent without modifying
the workspace, so they can be continued,
[stored, and shared](https://dvc.org/doc/use-cases/sharing-data-and-model-files)
in a normal Git + DVC workflow.
the workspace, so they can be continued, [stored and shared] in a normal Git +
DVC workflow.

To switch into the new branch, use `git checkout branch` and `dvc checkout`. Or
use `git merge branch` and `dvc repro` to combine it with your current project
version.

[`branch`]:
https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
[persistent]: /doc/user-guide/experiment-management/persisting-experiments
[checkpoint experiments]: /doc/command-reference/exp/run#checkpoints
[stored and shared]: /doc/use-cases/sharing-data-and-model-files

## Options

- `-h`, `--help` - shows the help message and exit.
Expand Down
45 changes: 20 additions & 25 deletions content/docs/command-reference/exp/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,40 @@ Provides a way to execute and track <abbr>experiments</abbr> in your
<abbr>project</abbr> without polluting it with unnecessary commits, branches,
directories, etc.

> `dvc exp run` is equivalent to `dvc repro` for experiments. It has the same
> behavior when it comes to `targets` and stage execution (restores the
> dependency graph, etc.). See the command [options](#options) for more on the
> differences.
> `dvc exp run` is equivalent to `dvc repro` for <abbr>experiments</abbr>. It
> has the same behavior when it comes to `targets` and stage execution (restores
> the dependency graph, etc.). See the command [options](#options) for more on
> the differences.
Before running an experiment, you'll probably want to make modifications such as
data and code updates, or <abbr>hyperparameter</abbr> tuning. For the latter,
you can use the `--set-param` (`-S`) option of this command to change
`dvc param` values on-the fly.

📖 See [DVC Experiments](/doc/user-guide/experiment-management) for more
information.

Each experiment creates and tracks a project variation based on your
<abbr>workspace</abbr> changes. Experiments will have a unique, auto-generated
name like `exp-bfe64` by default, which can be customized using the `--name`
(`-n`) option.

<details>

### ⚙️ How does DVC track experiments?

Experiments are custom
[Git references](https://git-scm.com/book/en/v2/Git-Internals-Git-References)
(found in `.git/refs/exps`) with a single commit based on `HEAD` (not checked
out by DVC). Note that these commits are not pushed to the Git remote by default
(see `dvc exp push`).
Each experiment creates and tracks a project variation based on the changes in
your <abbr>workspace</abbr>. The results of the last `dvc exp run` will be
reflected in the workspace. Experiments will have an auto-generated ID like
`exp-bfe64` by default. A custom name can be given instead, using the `--name`
(`-n`) option

</details>

The results of the last `dvc exp run` can be seen in the workspace. To display
and compare multiple experiments, use `dvc exp show` or `dvc exp diff`
(`plots diff` also accepts experiment names as `revisions`). Use `dvc exp apply`
to restore the results of any other experiment instead.

Successful experiments can be made
[persistent](/doc/user-guide/experiment-management#persistent-experiments) by
committing them to the Git repo. Unnecessary ones can be removed with
To display and compare multiple experiments, use `dvc exp show` or
`dvc exp diff` (`plots diff` also accepts experiment names as `revisions`). Use
`dvc exp apply` to restore the results of any experiment, for example to [commit
them][persisting] to Git. Unnecessary experiments can be removed with
`dvc exp remove`or `dvc exp gc` (or abandoned).

> Note that experiment data will remain in the <abbr>cache</abbr> until you use
> regular `dvc gc` to clean it up.
> Note that experiment data will remain in the local <abbr>cache</abbr> until
> you use regular `dvc gc` to clean it up.
[persisting]: /doc/user-guide/experiment-management/persisting-experiments

## Checkpoints

Expand Down

0 comments on commit 9ec36f2

Please sign in to comment.