MCPcopy Create free account
hub / github.com/LeapLabTHU/Absolute-Zero-Reasoner / show_sample

Function show_sample

evaluation/math_eval/eval/utils.py:304–326  ·  view source on GitHub ↗
(sample, print_all_preds=False)

Source from the content-addressed store, hash-verified

302
303
304def show_sample(sample, print_all_preds=False):
305 print("==" * 20)
306 for key in ["idx", "type", "level", "dataset"]:
307 if key in sample:
308 # capitalize
309 print("{}: {}".format(key[0].upper() + key[1:], sample[key]))
310 print("Question:", repr(sample["question"]))
311 if "code" in sample:
312 if print_all_preds:
313 for code in sample["code"]:
314 print("-" * 20)
315 print("code:", code)
316 print("Execution:", sample["report"])
317 else:
318 print("Solution:\n", sample["code"][0])
319 print("Execution:", sample["report"][0])
320 if "pred" in sample:
321 print("Prediction:", repr(sample["pred"][0]))
322 for key in ["gt", "score", "unit", "gt_cot"]:
323 if key in sample:
324 _key = key_map.get(key, key)
325 print("{}: {}".format(_key, repr(sample[key])))
326 print()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected