Skip to content

Commit bdcc095

Browse files
Dave Berenbaumpre-commit-ci[bot]
andauthored
lightning: support report kwarg (#369)
* lightning: support report kwarg * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9f9c31b commit bdcc095

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/dvclive/lightning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ def __init__(
1616
experiment=None,
1717
dir: Optional[str] = None, # noqa pylint: disable=redefined-builtin
1818
resume: bool = False,
19+
report: Optional[str] = "auto",
1920
):
2021

2122
super().__init__()
2223
self._prefix = prefix
23-
self._live_init: Dict[str, Any] = {"resume": resume}
24+
self._live_init: Dict[str, Any] = {"resume": resume, "report": report}
2425
if dir is not None:
2526
self._live_init["dir"] = dir
2627
self._experiment = experiment

tests/test_lightning.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,19 @@ def test_lightning_default_dir(tmp_dir):
127127
trainer.fit(model)
128128

129129
assert os.path.exists("dvclive")
130+
131+
132+
def test_lightning_kwargs(tmp_dir):
133+
model = LitXOR()
134+
# Handle kwargs passed to Live.
135+
dvclive_logger = DVCLiveLogger(dir="dir", report="md")
136+
trainer = Trainer(
137+
logger=dvclive_logger,
138+
max_epochs=2,
139+
enable_checkpointing=False,
140+
log_every_n_steps=1,
141+
)
142+
trainer.fit(model)
143+
144+
assert os.path.exists("dir")
145+
assert os.path.exists("dir/report.md")

0 commit comments

Comments
 (0)