Open
Conversation
|
|
||
| _state_dict_all_req_keys = ("epoch_length", "max_epochs") | ||
| _state_dict_one_of_opt_keys = ("iteration", "epoch") | ||
| _state_dict_all_req_keys = ("epoch_length",) |
Collaborator
There was a problem hiding this comment.
But if we interrupted the engine during the first epoch, we would not have epoch_length.
| _state_dict_all_req_keys = ("epoch_length", "max_epochs") | ||
| _state_dict_one_of_opt_keys = ("iteration", "epoch") | ||
| _state_dict_all_req_keys = ("epoch_length",) | ||
| _state_dict_one_of_opt_keys = (("iteration", "epoch",), ("max_epochs", "max_iters",)) |
Collaborator
There was a problem hiding this comment.
We can relax the constraint that the both max_epochs and max_iters could not have values.
| if self.state.epoch_length is not None: | ||
| self.state.epoch = self.state.iteration // self.state.epoch_length | ||
| elif "epoch" in state_dict: | ||
| else: |
Collaborator
There was a problem hiding this comment.
According to state_dict this should never happen.
| self.state.max_iters = max_iters | ||
|
|
||
| def _check_and_set_epoch_length(self, data: Iterable, epoch_length: Optional[int] = None) -> None: | ||
| # Can't we accept a redefinition ? |
Collaborator
There was a problem hiding this comment.
I think we can't because the relationship between epoch and iteration becomes invalid then. By the way in the case epoch_length is changed, we could reinitialize the state (with epoch and iteration zero along with a message to the user) as well.
|
|
||
| return time.time() - start_time | ||
|
|
||
| def debug(self, enabled: bool = True) -> None: |
Collaborator
There was a problem hiding this comment.
Do you still want to merge this method into the master?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1521
Description:
Engine.debug()methodCheck list: