"""score.py with one guard: a gold/prediction pair that makes score.py raise (e.g. string gold '111.242.222' vs a numeric prediction -> ValueError in float(gold)) is counted as wrong instead of crashing. Everything else, including the score.json format, is score.py unchanged. Same arguments as score.py. Used by run_baselines.sh only as a fallback when score.py itself crashes. """ import os, sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import score # noqa: E402 _correct = score.correct def guarded(item, pred, lenient=False): try: return _correct(item, pred, lenient) except (ValueError, TypeError): print(f"score_guarded: {item['id']}: score.py raised on pred {pred!r}; counted wrong", file=sys.stderr) return False score.correct = guarded if __name__ == '__main__': score.main()