|
81 | 81 | from lighteval.utils.language import Language |
82 | 82 |
|
83 | 83 |
|
84 | | -@scorer(metrics=[accuracy(), stderr()]) |
85 | | -def extractive_math_scorer(): |
86 | | - gold_extraction_target = (ExprExtractionConfig(), LatexExtractionConfig(boxed_match_priority=0)) |
87 | | - pred_extraction_target = (ExprExtractionConfig(), LatexExtractionConfig(boxed_match_priority=0)) |
88 | | - language = Language.ENGLISH |
89 | | - fallback_mode = "first_match" |
90 | | - extraction_mode = "first_match" |
91 | | - timeout_seconds = 5 |
| 84 | +# @scorer(metrics=[accuracy(), stderr()]) |
| 85 | +# def extractive_math_scorer(): |
| 86 | +# gold_extraction_target = (ExprExtractionConfig(), LatexExtractionConfig(boxed_match_priority=0)) |
| 87 | +# pred_extraction_target = (ExprExtractionConfig(), LatexExtractionConfig(boxed_match_priority=0)) |
| 88 | +# language = Language.ENGLISH |
| 89 | +# fallback_mode = "first_match" |
| 90 | +# extraction_mode = "first_match" |
| 91 | +# timeout_seconds = 5 |
92 | 92 |
|
93 | | - gold_extraction_regexes = get_extraction_regexes(gold_extraction_target, language) |
94 | | - pred_extraction_regexes = get_extraction_regexes(pred_extraction_target, language) |
| 93 | +# gold_extraction_regexes = get_extraction_regexes(gold_extraction_target, language) |
| 94 | +# pred_extraction_regexes = get_extraction_regexes(pred_extraction_target, language) |
95 | 95 |
|
96 | | - async def score(state: TaskState, target: Target): |
97 | | - extracted_predictions = extract_target_from_pred( |
98 | | - state.output.completion, pred_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
99 | | - ) |
100 | | - extracted_gold = extract_target_from_pred( |
101 | | - target.text, gold_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
102 | | - ) |
103 | | - return Score( |
104 | | - value="C" if extracted_predictions == extracted_gold else "I", |
105 | | - explanation=state.output.completion, |
106 | | - answer=str(extracted_predictions), |
107 | | - ) |
| 96 | +# async def score(state: TaskState, target: Target): |
| 97 | +# extracted_predictions = extract_target_from_pred( |
| 98 | +# state.output.completion, pred_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
| 99 | +# ) |
| 100 | +# extracted_gold = extract_target_from_pred( |
| 101 | +# target.text, gold_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
| 102 | +# ) |
| 103 | +# return Score( |
| 104 | +# value="C" if extracted_predictions == extracted_gold else "I", |
| 105 | +# explanation=state.output.completion, |
| 106 | +# answer=str(extracted_predictions), |
| 107 | +# ) |
108 | 108 |
|
109 | | - return score |
| 109 | +# return score |
110 | 110 |
|
111 | 111 |
|
112 | | -@scorer(metrics=[accuracy(), stderr()]) |
113 | | -def multichoice_scorer(): |
114 | | - language = Language.ENGLISH |
115 | | - gold_extraction_target = ( |
116 | | - IndicesExtractionConfig(prefix_for_extraction="NativeLetters", try_extract_without_anchor=True), |
117 | | - ) |
118 | | - pred_extraction_target = ( |
119 | | - IndicesExtractionConfig(prefix_for_extraction="NativeLetters", try_extract_without_anchor=True), |
120 | | - ) |
121 | | - fallback_mode = "first_match" |
122 | | - extraction_mode = "first_match" |
123 | | - timeout_seconds = 5 |
| 112 | +# @scorer(metrics=[accuracy(), stderr()]) |
| 113 | +# def multichoice_scorer(): |
| 114 | +# language = Language.ENGLISH |
| 115 | +# gold_extraction_target = ( |
| 116 | +# IndicesExtractionConfig(prefix_for_extraction="NativeLetters", try_extract_without_anchor=True), |
| 117 | +# ) |
| 118 | +# pred_extraction_target = ( |
| 119 | +# IndicesExtractionConfig(prefix_for_extraction="NativeLetters", try_extract_without_anchor=True), |
| 120 | +# ) |
| 121 | +# fallback_mode = "first_match" |
| 122 | +# extraction_mode = "first_match" |
| 123 | +# timeout_seconds = 5 |
124 | 124 |
|
125 | | - gold_extraction_regexes = get_extraction_regexes(gold_extraction_target, language, len_choices=4) |
126 | | - pred_extraction_regexes = get_extraction_regexes(pred_extraction_target, language, len_choices=4) |
| 125 | +# gold_extraction_regexes = get_extraction_regexes(gold_extraction_target, language, len_choices=4) |
| 126 | +# pred_extraction_regexes = get_extraction_regexes(pred_extraction_target, language, len_choices=4) |
127 | 127 |
|
128 | | - async def score(state: TaskState, target: Target): |
129 | | - extracted_predictions = extract_target_from_pred( |
130 | | - state.output.completion, pred_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
131 | | - ) |
132 | | - extracted_gold = extract_target_from_pred( |
133 | | - target.text, gold_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
134 | | - ) |
135 | | - return Score( |
136 | | - value="C" if extracted_predictions == extracted_gold else "I", |
137 | | - explanation=state.output.completion, |
138 | | - answer=str(extracted_predictions), |
139 | | - ) |
| 128 | +# async def score(state: TaskState, target: Target): |
| 129 | +# extracted_predictions = extract_target_from_pred( |
| 130 | +# state.output.completion, pred_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
| 131 | +# ) |
| 132 | +# extracted_gold = extract_target_from_pred( |
| 133 | +# target.text, gold_extraction_regexes, fallback_mode, extraction_mode, timeout_seconds |
| 134 | +# ) |
| 135 | +# return Score( |
| 136 | +# value="C" if extracted_predictions == extracted_gold else "I", |
| 137 | +# explanation=state.output.completion, |
| 138 | +# answer=str(extracted_predictions), |
| 139 | +# ) |
140 | 140 |
|
141 | | - return score |
| 141 | +# return score |
142 | 142 |
|
143 | 143 |
|
144 | 144 | class Metrics(Enum): |
|
0 commit comments