Skip to content

Conversation

@daavoo
Copy link
Contributor

@daavoo daavoo commented Jan 30, 2023

Add live._inside_with boolean to handle it.

The idea is to include additional data in an experiment when using frameworks:

from dvclive import Live
from dvclive.keras import DVCLiveCallback

with Live(save_dvc_exp=True) as live:
    live.log_param("foo", 2)
    model.fit(
        x, y,
        # Don't call live.end
        callbacks=[DVCLiveCallback(live=live)])
    # So it is possible to include additional data in the experiment
    live.summary["out-of-loop-metric"] = 1

@daavoo daavoo requested a review from dberenbaum January 30, 2023 17:51
Copy link
Contributor Author

@daavoo daavoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dberenbaum I think we already discussed this somewhere but can't remember. Just found it convenient to have for iterative/example-repos-dev#161

Add `live._inside_with` boolean to handle it.

The idea is to include additional data in a experiment when using frameworks:

```python
from dvclive import Live
from dvclive.keras import DVCLiveCallback

with Live(save_dvc_exp=True) as live:
    live.log_param("foo", 2)
    model.fit(
        x, y,
        # Don't call live.end so additional stuff can be logged
        callbacks=[DVCLiveCallback(live=live)])
    # So it is possible to include additional data in the experiment
    live.summary["out-of-loop-metric"] = 1
```
Copy link

@dberenbaum dberenbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's in #367? I guess we need a docs update to say that end gets ignored inside the context manager?

@daavoo daavoo linked an issue Jan 31, 2023 that may be closed by this pull request
@daavoo daavoo merged commit 4ff495a into main Jan 31, 2023
@daavoo daavoo deleted the add-inside-with branch January 31, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit live.end for complex scenarios

2 participants