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

Function run_execute

evaluation/math_eval/eval/parser.py:747–764  ·  view source on GitHub ↗
(executor, result, prompt_type, data_name, execute=False, azr=False)

Source from the content-addressed store, hash-verified

745
746
747def run_execute(executor, result, prompt_type, data_name, execute=False, azr=False):
748 if not result or result == "error":
749 return None, None
750 report = None
751
752 if azr:
753 prediction = extract_azr_answer(result, extraction_type="answer", data_name=data_name)
754 elif "program_only" in prompt_type:
755 prediction = extract_program_output(result)
756 elif prompt_type in ["pot", "pal"] and execute:
757 code = extract_program(result)
758 prediction, report = executor.apply(code)
759 else:
760 prediction = extract_answer(result, data_name)
761
762 # prediction = strip_string(prediction, skip_unit=data_name == "carp_en")
763 prediction = strip_string(prediction, skip_unit=data_name in STRIP_EXCEPTIONS)
764 return prediction, report
765
766
767def _test_extract_answer():

Callers 1

mainFunction · 0.85

Calls 6

extract_azr_answerFunction · 0.85
extract_program_outputFunction · 0.85
extract_programFunction · 0.85
extract_answerFunction · 0.70
strip_stringFunction · 0.70
applyMethod · 0.45

Tested by

no test coverage detected