Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: copy best model #659

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dvclive/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def finalize(self, status: str) -> None:
self._save_checkpoints(self._checkpoint_callback)
best_model_path = self._checkpoint_callback.best_model_path
self.experiment.log_artifact(
best_model_path, name="best", type="model", cache=False
best_model_path, name="best", type="model", copy=True
)
self.experiment.end()

Expand Down
3 changes: 3 additions & 0 deletions tests/test_frameworks/test_lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def test_lightning_log_model(tmp_dir, mocker, log_model, save_top_k):
if log_model in [True, "all"]:
trainer.fit(model)
assert len(os.listdir(tmp_dir / "model")) == num_checkpoints
log_artifact.assert_any_call(
checkpoint.best_model_path, name="best", type="model", copy=True
)


def test_lightning_steps(tmp_dir, mocker):
Expand Down