diff --git a/fastNLP/core/controllers/evaluator.py b/fastNLP/core/controllers/evaluator.py index bd66d0a0..865acc89 100644 --- a/fastNLP/core/controllers/evaluator.py +++ b/fastNLP/core/controllers/evaluator.py @@ -219,6 +219,7 @@ class Evaluator: def remove_progress_bar(self, dataloader_name): if self.progress_bar == 'rich' and hasattr(self, '_rich_task_id'): f_rich_progress.destroy_task(self._rich_task_id) + f_rich_progress.refresh() # 使得最终的bar可以消失 delattr(self, '_rich_task_id') elif self.progress_bar == 'raw': desc = 'Evaluation ends' @@ -229,6 +230,7 @@ class Evaluator: def finally_progress_bar(self): if self.progress_bar == 'rich' and hasattr(self, '_rich_task_id'): f_rich_progress.destroy_task(self._rich_task_id) + f_rich_progress.refresh() delattr(self, '_rich_task_id') @property diff --git a/fastNLP/core/utils/rich_progress.py b/fastNLP/core/utils/rich_progress.py index 256cc906..a865f4c1 100644 --- a/fastNLP/core/utils/rich_progress.py +++ b/fastNLP/core/utils/rich_progress.py @@ -94,9 +94,6 @@ class FRichProgress(Progress, metaclass=Singleton): self.print = self.console.print self.log = self.console.log - # start new - self.start() - self.console.show_cursor(show=True) return self def set_transient(self, transient: bool = True): @@ -154,6 +151,7 @@ class FRichProgress(Progress, metaclass=Singleton): super().start() self.console.show_cursor(show=True) + if (sys.stdin and sys.stdin.isatty()) and get_global_rank() == 0: f_rich_progress = FRichProgress().new_progess( "[progress.description]{task.description}",