Pause the rich live display while datasets materialize so hub tqdm progress (download/generating splits) is visible instead of being erased; reporter gains pause()/resume()

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-10 10:54:04 +00:00
parent c728db5f35
commit 8ea83fea4f
2 changed files with 14 additions and 0 deletions

View File

@ -478,7 +478,11 @@ def _cmd_eval_run(args) -> int:
_print_phase(console, i + 1, total_runs, name, _print_phase(console, i + 1, total_runs, name,
'loading/downloading dataset') 'loading/downloading dataset')
ds = get_dataset(name, **overrides) ds = get_dataset(name, **overrides)
if _shared_reporter is not None:
_shared_reporter.pause() # let hub tqdm print cleanly
sample_count = len(ds) sample_count = len(ds)
if _shared_reporter is not None:
_shared_reporter.resume()
origin = ds.lineage.get('from', 'unknown') origin = ds.lineage.get('from', 'unknown')
_print_phase(console, i + 1, total_runs, name, _print_phase(console, i + 1, total_runs, name,
f'dataset ready · samples={sample_count} · source={origin}') f'dataset ready · samples={sample_count} · source={origin}')

View File

@ -151,6 +151,16 @@ class RichTerminalProgress:
else: else:
self.console.print(message) self.console.print(message)
def pause(self):
"""Temporarily stop the live display (e.g. while hub downloads print
their own tqdm); task state is kept and resume() restores the bars."""
if self.task_id is not None or self.overall_id is not None:
self.progress.stop()
def resume(self):
if self.task_id is not None or self.overall_id is not None:
self.progress.start()
def close(self): def close(self):
if self.task_id is not None: if self.task_id is not None:
if self.heartbeat_task is not None: if self.heartbeat_task is not None: