benchmarks: harden longmemeval runner for Windows encoding - #1204
benchmarks: harden longmemeval runner for Windows encoding#1204mschultheiss83 wants to merge 1 commit into
Conversation
|
Nice fix on both layers. The same dual pattern (bare
The issue framing ("audit benchmark runners", plural) puts them in scope, FWIW. |
|
Audited the other benchmark runners for the same Same failure shape on any non-ASCII content. Up to you whether to expand scope here or leave them for a follow-up — both are reasonable, and the LongMemEval fix is a clean unit on its own. Thanks for the explicit-UTF-8 + ASCII-console-separator hardening; that's the right pattern. |
|
Thanks, this is helpful. I intentionally kept this PR narrow to the reproducible LongMemEval Windows failure from #1203 so the change stayed easy to review and validate. I agree the same pattern exists in |
|
Follow-up PR is the right call — keeps this one focused on the reproducible failure you opened it for, and the other three runners can land separately without complicating review here. If it's useful, I can take a swing at the follow-up since the audit was already done — but happy to leave it to you if you'd rather keep ownership of the benchmark hardening thread. Either works. |
|
Thanks, @jphein — agree a follow-up PR is the right call. If you’re up for it, please take a swing at the follow-up and own the changes for |
|
Filed #1382 covering |
… Windows Follow-up to MemPalace#1204 per @mschultheiss83's request — applies the same narrow Windows encoding fix to the three remaining LongMemEval-shaped benchmark runners that share the audit pattern jphein flagged in MemPalace#1204's review (`benchmarks/{locomo,membench,convomem}_bench.py`). For each file: - All `open(path)` / `open(path, "w")` calls gained `encoding="utf-8"` so cached benchmark JSON, palace-cache files, and result files are always read/written as UTF-8 instead of inheriting the platform default (cp1252 on Windows, GBK on Chinese Windows, etc.). Same pattern as MemPalace#1204's #2917 / #2927 / #2957 / #2998 / #3031. - Replaced non-ASCII separator characters in `print(...)` chrome with ASCII equivalents (`─` → `-`, `→` → `->`) so the runners don't raise `UnicodeEncodeError` on a default cp1252 console. Comments and docstrings (which never hit stdout) are untouched. - `urllib.request.urlopen(...)` calls left alone — they don't open local files, the original audit didn't flag them. Audit was already done in MemPalace#1204's thread; this PR carries the mechanical follow-through. No behavior change beyond Windows correctness. Refs MemPalace#1203 (the original Windows reproducer), MemPalace#1204 (sibling PR that fixed `longmemeval_bench.py`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… Windows Follow-up to MemPalace#1204 per @mschultheiss83's request — applies the same narrow Windows encoding fix to the three remaining LongMemEval-shaped benchmark runners that share the audit pattern jphein flagged in MemPalace#1204's review (`benchmarks/{locomo,membench,convomem}_bench.py`). For each file: - All `open(path)` / `open(path, "w")` calls gained `encoding="utf-8"` so cached benchmark JSON, palace-cache files, and result files are always read/written as UTF-8 instead of inheriting the platform default (cp1252 on Windows, GBK on Chinese Windows, etc.). Same pattern as MemPalace#1204's #2917 / #2927 / #2957 / #2998 / #3031. - Replaced non-ASCII separator characters in `print(...)` chrome with ASCII equivalents (`─` → `-`, `→` → `->`) so the runners don't raise `UnicodeEncodeError` on a default cp1252 console. Comments and docstrings (which never hit stdout) are untouched. - `urllib.request.urlopen(...)` calls left alone — they don't open local files, the original audit didn't flag them. Audit was already done in MemPalace#1204's thread; this PR carries the mechanical follow-through. No behavior change beyond Windows correctness. Refs MemPalace#1203 (the original Windows reproducer), MemPalace#1204 (sibling PR that fixed `longmemeval_bench.py`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… Windows (#1382) Follow-up to #1204 per @mschultheiss83's request — applies the same narrow Windows encoding fix to the three remaining LongMemEval-shaped benchmark runners that share the audit pattern jphein flagged in #1204's review (`benchmarks/{locomo,membench,convomem}_bench.py`). For each file: - All `open(path)` / `open(path, "w")` calls gained `encoding="utf-8"` so cached benchmark JSON, palace-cache files, and result files are always read/written as UTF-8 instead of inheriting the platform default (cp1252 on Windows, GBK on Chinese Windows, etc.). Same pattern as #1204's #2917 / #2927 / #2957 / #2998 / #3031. - Replaced non-ASCII separator characters in `print(...)` chrome with ASCII equivalents (`─` → `-`, `→` → `->`) so the runners don't raise `UnicodeEncodeError` on a default cp1252 console. Comments and docstrings (which never hit stdout) are untouched. - `urllib.request.urlopen(...)` calls left alone — they don't open local files, the original audit didn't flag them. Audit was already done in #1204's thread; this PR carries the mechanical follow-through. No behavior change beyond Windows correctness. Refs #1203 (the original Windows reproducer), #1204 (sibling PR that fixed `longmemeval_bench.py`). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Narrow Windows fix for the LongMemEval benchmark runner.
This PR addresses two reproducible failures in
benchmarks/longmemeval_bench.pyon native Windows:UnicodeEncodeErroron a defaultcp1252consoleChanges
tests/benchmarks/test_longmemeval_bench.pyReproduction
Before this change on Windows:
could fail with a
UnicodeDecodeErrorwhile reading the dataset, and after fixing file I/O the same runner could still fail withUnicodeEncodeErrorwhen printing separators to a non-UTF-8 console.After this change, the runner completes on the same machine without forcing UTF-8 mode.
Validation
Ran:
Result:
Ran:
Result:
Scope / Notes
benchmarks/longmemeval_bench.py