mirror of
https://gitee.com/fastnlp/fastNLP.git
synced 2024-12-02 12:17:35 +08:00
f_rich_progress不吃掉python prompt; evalutor在结束之后正常消失progres bar
This commit is contained in:
parent
388e426d78
commit
d10c6395f2
@ -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
|
||||
|
@ -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}",
|
||||
|
Loading…
Reference in New Issue
Block a user