-
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
protect progress bar callback #1855
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,6 @@ def __init__( | |
reload_dataloaders_every_epoch: bool = False, | ||
auto_lr_find: Union[bool, str] = False, | ||
replace_sampler_ddp: bool = True, | ||
progress_bar_callback: Optional[Union[ProgressBarBase, bool]] = True, | ||
terminate_on_nan: bool = False, | ||
auto_scale_batch_size: Union[str, bool] = False, | ||
num_tpu_cores: Optional[int] = None, # backward compatible, todo: remove in v0.9.0 | ||
|
@@ -364,7 +363,6 @@ def __init__( | |
rank_zero_warn("num_processes is only used for distributed_backend=\"ddp_cpu\". Ignoring it.") | ||
self.num_processes = num_processes | ||
|
||
self.process_position = process_position | ||
self.weights_summary = weights_summary | ||
|
||
self.max_epochs = max_epochs | ||
|
@@ -505,9 +503,7 @@ def __init__( | |
if show_progress_bar is not None: | ||
self.show_progress_bar = show_progress_bar | ||
|
||
self.progress_bar_refresh_rate = progress_bar_refresh_rate | ||
self.progress_bar_callback = progress_bar_callback | ||
self.configure_progress_bar() | ||
self._progress_bar_callback = self.configure_progress_bar(progress_bar_refresh_rate, process_position) | ||
|
||
# logging | ||
self.log_save_interval = log_save_interval | ||
|
@@ -660,7 +656,6 @@ def add_argparse_args(cls, parent_parser: ArgumentParser) -> ArgumentParser: | |
'min_steps': None, | ||
... | ||
'profiler': None, | ||
'progress_bar_callback': True, | ||
'progress_bar_refresh_rate': 1, | ||
...} | ||
|
||
|
@@ -755,6 +750,10 @@ def num_gpus(self) -> int: | |
def data_parallel(self) -> bool: | ||
return self.use_dp or self.use_ddp or self.use_ddp2 | ||
|
||
@property | ||
def progress_bar_callback(self): | ||
return self._progress_bar_callback | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure how much it protects as it handles pointer to the same object so edit in the return will appear in the original one... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes I think that's fine. the goal was to make the reference read-only so that you can't change the reference to anything other than a progress bar. |
||
|
||
@property | ||
def progress_bar_dict(self) -> dict: | ||
""" Read-only for progress bar metrics. """ | ||
|
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 ques we can allow multiple in future, just check that each is different, meaning another monitor event, frequency, etc.
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 agree that would be good. the only reason why we currently have a limit of 1 is because Trainer needs to be able to disable the progress bar temporarily, for example in LRFinder.