Download tools/probe_report.py from RightNowAI/duplex-v0: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/probe_report.py
- Command line
-
hf download hf://RightNowAI/duplex-v0/tools/probe_report.py
-
curl -L -o probe_report.py https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/probe_report.py
1.6 kB
| """Summarise what the baseline streamed in each probe run (eval/results/probe/raw_*.jsonl): | |
| where text and audio tokens arrive, and when. | |
| python -m tools.probe_report eval/results/probe | |
| """ | |
| import json | |
| import re | |
| import sys | |
| from pathlib import Path | |
| AUDIO = re.compile(r"<audio_\d+>") | |
| def main(): | |
| for path in sorted(Path(sys.argv[1]).glob("raw_*.jsonl")): | |
| rows = [json.loads(line) for line in open(path, encoding="utf-8")] | |
| if not rows: | |
| print(f"== {path.name}: empty") | |
| continue | |
| tts = lambda r, k: (r["delta"].get("tts_content") or {}).get(k) or "" | |
| text = "".join(tts(r, "tts_text") or r["delta"].get("content") or "" for r in rows) | |
| in_tts = [(r["t"], len(AUDIO.findall(tts(r, "tts_audio")))) for r in rows] | |
| in_content = sum(len(AUDIO.findall(r["delta"].get("content") or "")) for r in rows) | |
| n_audio = sum(n for _, n in in_tts) | |
| first_audio = next((t for t, n in in_tts if n), None) | |
| t25 = None | |
| seen = 0 | |
| for t, n in in_tts: | |
| seen += n | |
| if seen >= 28 and t25 is None: | |
| t25 = t | |
| print(f"== {path.name}: {len(rows)} chunks, first at {rows[0]['t']} s, last at {rows[-1]['t']} s") | |
| print(f" audio tokens in tts_audio: {n_audio} (first at {first_audio} s, 28th at {t25} s); audio tokens inside content: {in_content}") | |
| print(f" delta keys: {sorted({k for r in rows for k in r['delta']})}") | |
| print(f" text[:300]: {text[:300]!r}") | |
| print(f" text[-200:]: {text[-200:]!r}") | |
| if __name__ == "__main__": | |
| main() | |