-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Adding max_iters as an optional arg in Engine run #1381
Conversation
@thescripted Thank you ! I left few comments. |
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.
@thescripted Thanks for working on the PR !
I left few comment on how to improve it
@thescripted could you also please resolve the conflict and update your branch to master. |
On it. Sorry for the late reply I've put a bit on my plate with other projects. I'll go ahead and resolve these issues now. |
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.
Thanks @thescripted ! Looks good
I still have few comments about the PR. For example, a special care is needed here
while self.state.epoch < self.state.max_epochs
if max_epochs
is None, right ?
Yes @vfdev-5, I didn't consider that. I believe a fix could be like so: while not self.should_terminate: # type: ignore[operator]
if self.state.max_epochs is not None and self.state.epoch >= self.state.max_epochs:
break I also think a condition to check the max_iters here is required. ignite/ignite/engine/engine.py Lines 559 to 560 in acd2982
From what I can tell max_epochs will never be none, given where and how the method is used Here and Here. I can just add another conditional checking if If those are the right track (and any additional comments you have) I'll be happy to fix those up. |
@thescripted good point about while self.state.epoch < self.state.max_epochs and not self.should_terminate: by def _is_done(state: State) -> bool:
# something like that
c1 = state.max_iters and state.iterations == state.max_iters
c2 = state.epoch_length and state.iteration == state.epoch_length * state.max_epochs
return c1 or c2
while not self._is_done(self.state) and not self.should_terminate: What do you think ? |
Fixes #1300
Description:
New tests have not yet been written, and I believe some descriptions/comments will need to be updated. I'm happy to do that, but I'm opening up this PR for feedback and general indications to see if I'm on the right track.
I've assumed that reaching max iteration will fire a "Terminate" event rather than "Epoch Completed," but I don't know if either of those events are accurate for this condition.
FInally, adding a condition to this block:
ignite/ignite/engine/engine.py
Lines 557 to 558 in a8a9c7c
currently breaks some tests, so I have left that alone for the moment.
Check list: