Narration lines get stage icons (⬇ download / 📦 ready / ✳ few-shot / ◷ checkpoint / 🤖 generating / ⏭ skipped / ★ scoring / 📝 writing / 🔗 endpoint) and cyan-highlighted paths

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-10 11:29:07 +00:00
parent 3a045e0569
commit e7792a559c

View File

@ -198,6 +198,39 @@ def _print_run_plan(console, args, model_spec):
justify='center') justify='center')
def _narration(msg: str) -> str:
"""Icon + path-highlighting for narration lines (visual separation at
a glance; paths in cyan)."""
icon = ''
m = msg.lower()
if m.startswith('loading/'):
icon = ''
elif 'dataset ready' in m:
icon = '📦 '
elif 'few-shot' in m:
icon = ''
elif 'checkpoint' in m or m.endswith('samples') or 'to generate' in m:
icon = ''
elif 'generation skipped' in m:
icon = ''
elif 'generating' in m:
icon = '🤖 '
elif 'generation complete' in m:
icon = ''
elif 'scoring' in m:
icon = ''
elif 'writing' in m:
icon = '📝 '
elif 'endpoint ok' in m:
icon = '🔗 '
# highlight any trailing path after '->'
if '-> ' in msg:
head, _, tail = msg.partition('-> ')
return f'{icon}{head}-> [cyan]{tail}[/cyan]'
return f'{icon}{msg}'
def _phase_color(message: str) -> str: def _phase_color(message: str) -> str:
"""Narration line color. Currently PLAIN WHITE for everything (user """Narration line color. Currently PLAIN WHITE for everything (user
preference); flip the returns to 'yellow'/'green' to restore the preference); flip the returns to 'yellow'/'green' to restore the
@ -213,7 +246,7 @@ def _phase_color(message: str) -> str:
def _print_phase(console, index, total, name, message): def _print_phase(console, index, total, name, message):
# single-benchmark runs: the [1/1] tag is noise, drop it # single-benchmark runs: the [1/1] tag is noise, drop it
prefix = f'[{index}/{total}] ' if total > 1 else '' prefix = f'[{index}/{total}] ' if total > 1 else ''
text = f'{prefix}{name}: {message}' text = f'{prefix}{name}: {_narration(message)}'
color = _phase_color(message) color = _phase_color(message)
if console is not None: if console is not None:
if color: if color:
@ -221,7 +254,9 @@ def _print_phase(console, index, total, name, message):
else: else:
console.print(text, highlight=False) console.print(text, highlight=False)
else: else:
print(text, flush=True) import re as _re0
print(_re0.sub(r'\[/?[a-z ]+\]', '', text), flush=True)
def _print_benchmark_result(console, index, total, name, status, elapsed): def _print_benchmark_result(console, index, total, name, status, elapsed):
@ -496,9 +531,8 @@ def _cmd_eval_run(args) -> int:
def _emit(msg, _i=i, _n=name): def _emit(msg, _i=i, _n=name):
if _shared_reporter is not None: if _shared_reporter is not None:
_col = _phase_color(msg) _shared_reporter.log(
_line = f'[{_i + 1}/{total_runs}] {_n}: {msg}' f'[{_i + 1}/{total_runs}] {_n}: {_narration(msg)}')
_shared_reporter.log(f'[{_col}]{_line}[/{_col}]' if _col else _line)
else: else:
_print_phase(console, _i + 1, total_runs, _n, msg) _print_phase(console, _i + 1, total_runs, _n, msg)
@ -535,9 +569,7 @@ def _cmd_eval_run(args) -> int:
_console=console): _console=console):
_tag = f'[{_idx}/{total_runs}] ' if total_runs > 1 else '' _tag = f'[{_idx}/{total_runs}] ' if total_runs > 1 else ''
if _reporter is not None: if _reporter is not None:
_col = _phase_color(msg) _reporter.log(f'{_tag}{_name}: {_narration(msg)}')
_line = f'{_tag}{_name}: {msg}'
_reporter.log(f'[{_col}]{_line}[/{_col}]' if _col else _line)
if 'scoring' in msg: if 'scoring' in msg:
_reporter.set_phase('scoring') _reporter.set_phase('scoring')
elif 'generating model responses' in msg: elif 'generating model responses' in msg: