tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 611 forks source link

TQDMProgressBar(leave_overall_progress=False) in consort with the EarlyStoppingCallback() dosn't leave progress bar #2774

Open PhorstenkampFuzzy opened 2 years ago

PhorstenkampFuzzy commented 2 years ago

System information

Describe the bug When using the TQDMProgressBar(leave_overall_progress=False) in consort with the EarlyStoppingCallback() the overall progress bar does not disappear. I assume this is not a feature but a bug.

Solution If lines 5 to 7 from the following code snippet are inserted the behavior changes and the progressbar disappears after training.

       # line 143 of tensorflow_addons.callbacks.tqdm_progress_bar.py
        def _clean_up_progbar(self, hook, logs):
            if hook == "train_overall":
                if self.show_overall_progress:
                    self.overall_progress_tqdm.update(
                        self.num_epochs - self.overall_progress_tqdm.n
                    )
                    self.overall_progress_tqdm.close()