Skip to content

Commit

Permalink
dvclive: update log_artifact options
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenbaum committed Jul 11, 2023
1 parent a4c32b3 commit e956037
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
9 changes: 5 additions & 4 deletions content/docs/dvclive/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ can be tracked in Git and becomes part of the experiment. With this metadata
file, you can [retrieve](/doc/start/data-management/data-versioning#retrieving)
the versioned artifact from the Git commit.

If `Live` was initialized with `dvcyaml=True` (which is the default), this will
add an [artifact](/doc/user-guide/project-structure/dvcyaml-files#artifacts) to
the corresponding `dvc.yaml`. Passing `type="model"` will mark it as a `model`
for DVC and will also show it in
If `Live` was initialized with `dvcyaml=True` (which is the default) and you
include values for any of the optional metadata arguments, this will add an
[artifact](/doc/user-guide/project-structure/dvcyaml-files#artifacts) to the
corresponding `dvc.yaml`. Passing `type="model"` will mark it as a `model` for
DVC and will also show it in
[Studio Model Registry](/doc/studio/user-guide/model-registry/what-is-a-model-registry).

Using `Live.log_image()` to log multiple images may also grow too large to track
Expand Down
14 changes: 11 additions & 3 deletions content/docs/dvclive/live/log_artifact.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def log_artifact(
labels: Optional[List[str]] = None,
meta: Optional[Dict[str, Any]] = None,
copy: Optional[bool] = False,
cache: Optional[bool] = True,
):
```

Expand Down Expand Up @@ -39,9 +40,11 @@ Uses `dvc add` to track `path` with DVC, generating a `{path}.dvc` file. When
combined with [`save_dvc_exp=True`](/doc/dvclive#initialize-dvclive), it will
ensure that `{path}.dvc` is included in the experiment.

If `Live` was initialized with `dvcyaml=True` (which is the default), it will
add an [artifact](/doc/user-guide/project-structure/dvcyaml-files#artifacts) and
all the metadata passed as arguments to the corresponding `dvc.yaml`. Passing
If `Live` was initialized with `dvcyaml=True` (which is the default) and you
include any of the optional metadata fields (`type`, `name`, `desc`, `labels`,
`meta`), it will add an
[artifact](/doc/user-guide/project-structure/dvcyaml-files#artifacts) and all
the metadata passed as arguments to the corresponding `dvc.yaml`. Passing
`type="model"` will mark it as a `model` for DVC and will make it appear in
[Studio Model Registry](/doc/studio).

Expand All @@ -68,6 +71,11 @@ all the metadata passed as arguments to the corresponding `dvc.yaml`. Passing
artifact. Useful if you don't want to track the original path in your repo
(for example, it is outside the repo or in a Git-ignored directory).

- `cache` - <abbr>cache</abbr> the files with DVC to
[track](/doc/dvclive/how-it-works#track-large-artifacts-with-dvc) them outside
of Git. Defaults to `True`, but set to `False` if you want to annotate
metadata about the artifact without storing a copy in the DVC cache.

## Exceptions

- `dvclive.error.InvalidDataTypeError` - thrown if the provided `path` does not
Expand Down
2 changes: 1 addition & 1 deletion content/docs/dvclive/ml-frameworks/pytorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ with Live(save_dvc_exp=True, report="notebook") as live:

live.next_step()

live.log_artifact("model.pt")
live.log_artifact("model.pt", type="model", name="pytorch-model")
```

0 comments on commit e956037

Please sign in to comment.