Skip to content

Commit d261760

Browse files
author
Dave Berenbaum
authored
add cache_images to lightning (#614)
* add cache_images to lightning * fix cache_images in lightning * add test for lightning cache_images
1 parent a0de508 commit d261760

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/dvclive/lightning.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(
4444
report: Optional[str] = "auto",
4545
save_dvc_exp: bool = False,
4646
dvcyaml: bool = True,
47+
cache_images: bool = False,
4748
):
4849
super().__init__()
4950
self._prefix = prefix
@@ -52,6 +53,7 @@ def __init__(
5253
"report": report,
5354
"save_dvc_exp": save_dvc_exp,
5455
"dvcyaml": dvcyaml,
56+
"cache_images": cache_images,
5557
}
5658
if dir is not None:
5759
self._live_init["dir"] = dir

tests/test_frameworks/test_lightning.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def test_lightning_default_dir(tmp_dir):
144144
def test_lightning_kwargs(tmp_dir):
145145
model = LitXOR()
146146
# Handle kwargs passed to Live.
147-
dvclive_logger = DVCLiveLogger(dir="dir", report="md", dvcyaml=False)
147+
dvclive_logger = DVCLiveLogger(
148+
dir="dir", report="md", dvcyaml=False, cache_images=True
149+
)
148150
trainer = Trainer(
149151
logger=dvclive_logger,
150152
max_epochs=2,
@@ -156,6 +158,7 @@ def test_lightning_kwargs(tmp_dir):
156158
assert os.path.exists("dir")
157159
assert os.path.exists("dir/report.md")
158160
assert not os.path.exists("dir/dvc.yaml")
161+
assert dvclive_logger.experiment._cache_images is True
159162

160163

161164
def test_lightning_steps(tmp_dir, mocker):

0 commit comments

Comments
 (0)