Skip to content

Commit

Permalink
Merge branch 'main' into cloud-exp-gif
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Berenbaum authored Jul 5, 2023
2 parents 1164099 + 9916b61 commit b74e507
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions content/docs/dvclive/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ 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
with Git, in which case you can use
[`Live(cache_images=True)`](/doc/dvclive/live#parameters) to cache them.

### Run with DVC

Experimenting in Python interactively (like in notebooks) is great for
Expand Down
3 changes: 3 additions & 0 deletions content/docs/dvclive/live/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ You can use `Live()` as a context manager. When exiting the context manager,

</admon>

- `cache_images` - If `True`, DVCLive will <abbr>cache</abbr> any images logged
with `Live.log_image()` as part of `Live.end()`. Defaults to `False`.

- `exp_message` - If not `None`, and `save_dvc_exp` is `True`, the provided
string will be passed to
[`dvc exp save --message`](/doc/command-reference/exp/save#--message).
Expand Down
17 changes: 12 additions & 5 deletions content/docs/dvclive/live/log_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def log_image(name: str, val):
```py
from dvclive import Live

with Live() as live:
with Live(cache_images=True) as live:
# 1. Log an image from a numpy array:
import numpy as np
img_numpy = np.ones((500, 500), np.uint8) * 255
Expand Down Expand Up @@ -39,14 +39,21 @@ Supported values for `val` are:
should be in a format that is readable by
[`PIL.Image.open()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open)

The images will be saved in `{Live.plots_dir}/images/{name}`:
The images will be saved in `{Live.plots_dir}/images/{name}`. When using
[`Live(cache_images=True)`](/doc/dvclive/live#parameters), the images directory
will also be <abbr>cached</abbr> as part of `Live.end()`. In that case, a `.dvc`
file will be saved to [track](/doc/dvclive/how-it-works#track-the-results) it,
and the directory will be added to a `.gitignore` file to prevent Git tracking:

```
dvclive
└── plots
└── images
β”œβ”€β”€ numpy.png
└── pil.png
Β Β  β”œβ”€β”€ .gitignore
Β Β  β”œβ”€β”€ images
Β Β  β”‚Β Β  β”œβ”€β”€ numpy.png
Β Β  β”‚Β Β  β”œβ”€β”€ pil.png
Β Β  β”‚Β Β  └── sample.png
└── images.dvc
```

<admon type="tip">
Expand Down

0 comments on commit b74e507

Please sign in to comment.