-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
remove trainer hidden state | sanity refactor [2 / n] #7507
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #7507 +/- ##
======================================
- Coverage 92% 92% -0%
======================================
Files 196 196
Lines 12828 12827 -1
======================================
- Hits 11825 11808 -17
- Misses 1003 1019 +16 |
… into refactor/trainer-state-sanity-1
for more information, see https://pre-commit.ci
@@ -1619,7 +1619,7 @@ def get_progress_bar_dict(self): | |||
module_tbptt_enabled = self.truncated_bptt_steps > 0 | |||
trainer_tbptt_enabled = self.trainer.truncated_bptt_steps is not None and self.trainer.truncated_bptt_steps > 0 | |||
if module_tbptt_enabled or trainer_tbptt_enabled: | |||
tqdm_dict["split_idx"] = self.trainer.split_idx | |||
tqdm_dict["split_idx"] = self.trainer.train_loop.split_idx |
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.
is get_progress_bar_dict
still needed on the lightning module? wouldn't things come from self.log
?
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.
it's for users to override and customize the default elements in the progress bar. Like how the version number is displayed or apparently the split index here.
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.
It's not something one could customize through self.log directly I would say.
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.
Is it customization we would want to push to a custom progress bar callback instead of being part of the core module?
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.
custom progress bar callback instead of being part of the core module?
IMO yes for maximum separation of concerns
But people might complain about having to define a custom progress bar just for this
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.
one could argue maybe the split_idx is not very useful to display in the progbar but still I would keep the hook
|
||
self.global_step = 0 | ||
self.current_epoch = 0 | ||
self.trainer.should_stop = False | ||
|
||
self.total_batch_idx = 0 | ||
self.batch_idx = 0 | ||
self.split_idx = None |
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.
- is this meant to be writable from the outside? should these be made available as properties instead?
- while going through this, could you add a comment for what split_idx means for contributors who go through this code later?
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.
no but for now I follow the above pattern and the major goal is to define this state strictly on the loop, not the trainer anymore.
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.
while going through this, could you add a comment for what split_idx means for contributors who go through this code later?
yes
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.
okay added comments
@@ -1619,7 +1619,7 @@ def get_progress_bar_dict(self): | |||
module_tbptt_enabled = self.truncated_bptt_steps > 0 | |||
trainer_tbptt_enabled = self.trainer.truncated_bptt_steps is not None and self.trainer.truncated_bptt_steps > 0 | |||
if module_tbptt_enabled or trainer_tbptt_enabled: | |||
tqdm_dict["split_idx"] = self.trainer.split_idx | |||
tqdm_dict["split_idx"] = self.trainer.train_loop.split_idx |
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.
custom progress bar callback instead of being part of the core module?
IMO yes for maximum separation of concerns
But people might complain about having to define a custom progress bar just for this
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.
LGTM !
What does this PR do?
Follow up to #7437 with more writable state removed from trainer:
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃