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

next_step() needs log() #232

Closed
casperdcl opened this issue Apr 1, 2022 · 6 comments
Closed

next_step() needs log() #232

casperdcl opened this issue Apr 1, 2022 · 6 comments
Labels
discussion requires active participation to reach a conclusion refactoring

Comments

@casperdcl
Copy link

casperdcl commented Apr 1, 2022

import dvclive

live = dvclive.Live(resume=True)
while (epoch := live.get_step()) < 10:
  print(epoch)
  live.log("epoch", epoch)  # need to log at least one thing for `next_step` to work
  live.next_step()
  • current: dvclive.json is stuck on step: 0 if we remove the live.log() command.
  • current (after live: Moved all make_{x} to next_step(). #353) dvclive.json doesn't exists if we remove the live.log() command.
  • expected: step: 9 even without live.log()

Related: iterative/cml.dev#207

@casperdcl casperdcl changed the title next_step need log next_step() needs log() Apr 1, 2022
@daavoo
Copy link
Contributor

daavoo commented Apr 4, 2022

The step is being correctly updated internally (even if you remove the log call, the while loop breaks) but the updates are not being dumped to the summary file dvclie.json. This is because we moved the summary updates to log calls (#145).

Not sure what to do here. The summary is intended to track logged scalars and we just include step for convenience 🤔

cc @dberenbaum

@daavoo daavoo added discussion requires active participation to reach a conclusion refactoring labels Apr 4, 2022
@casperdcl
Copy link
Author

casperdcl commented Apr 4, 2022

Seems odd to do this. If there are multiple things to log per iteration, you dump multiple times?

  • Seems better to dump only on next_step()
  • Could also make configurable default log(..., write_summary=False)
  • Could make next_step() internally use log("step", ..., write_summary=True)

I don't quite follow the wording in #145 but from what I can tell it seems identical to this issue (#232) so shouldn't have been closed?

@dberenbaum
Copy link
Collaborator

dberenbaum commented Apr 4, 2022

@casperdcl Why do you want to use next_step() without log()? I don't see a problem doing so, but I'm confused how it's useful.

Edit: To clarify, I meant that your expectations seem reasonable, but I'd like to better understand the context.

@casperdcl
Copy link
Author

casperdcl commented Apr 6, 2022

Full context is step is the only thing that is required in order to resume interrupted training (notice the example above uses get_step()) - we don't need to log loss nor any other metrics, and we don't need to use dvc {exp run,repro}.

Second unrelated lower-priority follow-up issue is optimisation:

If there are multiple things to log per iteration, you dump multiple times?

@dberenbaum
Copy link
Collaborator

We probably need to decouple log() from setting the step to resolve this issue.

@casperdcl I moved the optimization to #238.

Both are good points that are largely due to changes in the codebase over time and should probably be changed now AFAIK.

@dberenbaum
Copy link
Collaborator

Actually, I think we just need to call make_summary() always during set_step() (ignoring #238).

daavoo added a commit that referenced this issue Nov 3, 2022
`log_metric` now stores logged value in `live.summary` but doesn't call `make_summary` as before.

Call `make_summary` inside `live.end`.

Closes #238
Closes #232
daavoo added a commit that referenced this issue Nov 4, 2022
`log_metric` now stores logged value in `live.summary` but doesn't call `make_summary` as before.

Call `make_summary` inside `live.end`.

Closes #238
Closes #232
@daavoo daavoo closed this as completed Nov 4, 2022
daavoo added a commit that referenced this issue Nov 4, 2022
`log_metric` now stores logged value in `live.summary` but doesn't call `make_summary` as before.

Call `make_summary` inside `live.end`.

Closes #238
Closes #232
daavoo added a commit that referenced this issue Nov 4, 2022
`log_metric` now stores logged value in `live.summary` but doesn't call `make_summary` as before.

Call `make_summary` inside `live.end`.

Closes #238
Closes #232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion requires active participation to reach a conclusion refactoring
Projects
None yet
Development

No branches or pull requests

3 participants