-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add a frequency
parameter to TriggerWandbSyncLightningCallback
#101
base: main
Are you sure you want to change the base?
Conversation
Review changes with SemanticDiff. Analyzed 3 of 3 files. Overall, the semantic diff is 51% smaller than the GitHub diff.
|
src/wandb_osh/lightning_hooks.py
Outdated
@@ -41,6 +43,7 @@ def __init__( | |||
""" | |||
super().__init__() | |||
self._hook = TriggerWandbSyncHook(communication_dir=communication_dir) | |||
self.frequency = frequency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make this private? i.e., self._frequency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea
I like this, this would be an alternate way of solving #83 and much simpler than implementing multiprocessing. As for tests, I think this is fine, I'd say it's simple enough :) |
src/wandb_osh/lightning_hooks.py
Outdated
@@ -24,11 +24,13 @@ class TriggerWandbSyncLightningCallback(pl.Callback): | |||
def __init__( | |||
self, | |||
communication_dir: PathLike = _comm_default_dir, | |||
frequency: int = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's a better name for this. Because this setting is basically 1/frequency
, right? (the larger this value is, the less often we sync). So perhaps something like sync_every_n_epochs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started with such a name but thought that frequency was shorter and still self-explanatory.
I will make the change to sync_every_n_epochs
, it is more accurate
…tialization Now the calling `hook()` must be done by giving information about the current epoch
…ialization and call
I made the changes. Still without testing 😇 |
I just realized that the
I see an easy fix for the Lightning callback; adding the |
Oh you're 100% right, I should have thought about that as well. A totally different avenue of solution (that might also help with syncing hyperparameters of runs that get killed because of #100) would be that the Let me think about that. We might in fact do both (and perhaps add a note to the |
That would be a pretty robust workaround indeed. I dug into the problem I raised in #100 and this is deeper that just not syncing the config. i will detail what I found so far in the Issue. |
@klieret should I push this temporary fix? |
…tion on the end of the last epoch
for more information, see https://pre-commit.ci
Sorry for my late replies! Let me take a look now :) |
Could you give me push permission on the branch (I made some fixes and added some tests to this). You only have to click a checkbox on this PR, I think |
The box is checked, it seems to be checked by default btw |
Hi @klieret, any update about this PR? |
In order to synchronize every N epoch instead of every epoch (by default), I added a frequency parameter to the Lightning callback.
I did not write any test for that feature, mainly because I am not sure how you proceed (but also because of lazyness 😅)
Tell me if you want me to add a test for that.