Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Give the option to terminate the engine without firing Events.COMPLET… #3309
Give the option to terminate the engine without firing Events.COMPLET… #3309
Changes from 11 commits
addd578
5cbca17
c907d6a
42d9da6
5a5babd
b6c9bbf
f1d194a
5f2cd88
833b56e
9509e0b
44e837e
3f38645
17e973f
7e408b7
8ecf8f0
1c493eb
58ad05f
cf1cbcd
993678e
a133dfb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@bonassifabio actually, I find myself as well this table very misleading and hard to understand.
I think we can improve it in the following way:
terminate()
line onTERMINATE_SINGLE_EPOCH
column is wrong actually and should be replaced withx
.By the way, here is how it is generated now: https://deploy-preview-3309--pytorch-ignite-preview.netlify.app/generated/ignite.engine.events.events#ignite.engine.events.Events
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.
Actually, I was interpreting the first column as Events.COMPLETED, but from your comment it would seem that's not the case.
What if we change the table to something like this?
TERMINATE_SINGLE_EPOCH
EPOCH_COMPLETED
TERMINATE
COMPLETED
terminate_epoch()
terminate()
terminate(skip_completed=True)
Few comments:
terminate()
is called, the epoch is not necessarily completed. If this statement is true, it would perhaps make more sense to moveEPOCH_COMPLETED
beforeTERMINATE
in the list of Events, as I did in the table, sinceEPOCH_COMPLETED
would almost never be fired afterEPOCH_COMPLETED
.terminate(skip_completed=True)
. Not sure if that's really necessary.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 for the new table, looks good!
Few corrections however about its content:
The line
terminate_epoch()
, column "EPOCH_COMPLETED" and "COMPLETED" should be both checked asv
.About your comments, I'm OK with all your suggestions, let's keep this order and the new line.
Checking code:
Output:
You can run it in https://pytorch-ignite.ai/playground
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.
Thank you for pointing this out!
skip_completed
toterminate_epoch()
with the same behavior of suppressing the firing ofEvents.EPOCH_COMPLETED
? That might be useful, for example, to avoid running the evaluator, the checkpointer, and the LR scheduler if an epoch has been terminated.EPOCH_COMPLETED
forterminate_epoch()
. However, I think that checkingCOMPLETED
might seem to imply thatEvents.COMPLETED
is also fired byterminate_epoch()
right afterEvents.EPOCH_COMPLETED
. What if we leave that cell empty?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.
Good idea! Let's make this in a separate PR such that this one does not become too large
well, I was seeing this table as showing which events are triggered when we call
terminate*()
functions. I did not understandv
mark on COMPLETED forterminate_epoch
as the sequence of triggered events, but just whether an event is triggered or not. To avoid misunderstanding we can add a column betweenEPOCH_COMPLETED
andTERMINATE
named as for example "Other events" and check it where it is appropriate. What do you think?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.
Cool, I'll create a new PR when we're done with this one
I see the point, but doesn't the firing of
TERMINATE
andCOMPLETED
independent ofterminate_epoch()
?See for example this code.
This is probably an edge case. As a newbie of ignite, it would honestly make more sense to see no entry for
TERMINATE
andCOMPLETED
forterminate_epoch()
. However, you are for sure more experienced than me, so we can go ahead with your solution if you prefer 🙂Solution 1
TERMINATE_SINGLE_EPOCH
EPOCH_COMPLETED
TERMINATE
COMPLETED
terminate_epoch()
terminate()
terminate(skip_completed=True)
Solution 2
TERMINATE_SINGLE_EPOCH
EPOCH_COMPLETED
TERMINATE
COMPLETED
terminate_epoch()
terminate()
terminate(skip_completed=True)
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, they should be independent, i would say. If this is not the case, it should be a bug...
Actually, your feedback is more important as other users may think the same (and those who know how it works do not read the docs :) ) !
Initially, the goal of the table is to provide visual representation of the info on which events are triggered in each case (when call
terminate*()
) and also compared with regular run.Now, seeing its content I find this tabular representation more misleading than useful as triggered events depend on where the terminate function was called.
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 would propose to keep the table (either Table 1 or Table 2), and then to open a new issue to seek some input also from other developers/users and discuss the problem more in detail there.
We could for example think to a flow chart diagram or something like that...
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.
Personally I would remove it and maybe added some code output to show exactly how it works...
OK, up to you, either let's revert the changes or keep the most understandable version and update it later.