(self)
| 156 | |
| 157 | |
| 158 | def get_expected_outputs(self): |
| 159 | prompts, overlong_prompts = self.dataset.get_all_prompts() |
| 160 | |
| 161 | max_count = 1 |
| 162 | count = 0 |
| 163 | |
| 164 | for index, prompt in enumerate(prompts + overlong_prompts): |
| 165 | #if "Write a function to find the nth newman" not in prompt: |
| 166 | # continue |
| 167 | if len(self.dataset.prompt2groundtruth[prompt]) == 0: |
| 168 | continue |
| 169 | elif len(self.dataset.prompt2testcase[prompt]) == 0: |
| 170 | continue |
| 171 | gt, io = self.dataset.prompt2groundtruth[prompt][0] |
| 172 | print(index) |
| 173 | stat, results = self.execute_code(gt, io, self.dataset.prompt2testcase[prompt], check = False) |
| 174 | |
| 175 | if stat == "fail": |
| 176 | print(results) |
| 177 | print() |
| 178 | print(self.dataset.prompt2testcase[prompt]) |
| 179 | print() |
| 180 | print(gt) |
| 181 | print() |
| 182 | print(prompt) |
| 183 | self.dataset.prompt2testcase[prompt] = [] |
| 184 | count += 1 |
| 185 | if count > max_count: |
| 186 | raise ValueError("Groundtruth solution verification failed!") |
| 187 | continue |
| 188 | if len(results) != len(self.dataset.prompt2testcase[prompt]): |
| 189 | raise ValueError("Num of returned results is inconsistent with original testcase inputs.") |
| 190 | for i, res in enumerate(results): |
| 191 | self.dataset.prompt2testcase[prompt][i]["output"] = res["model_output"] |
| 192 | try: |
| 193 | json.dumps(self.dataset.prompt2testcase[prompt]) |
| 194 | except: |
| 195 | self.dataset.prompt2testcase[prompt] = [] |
| 196 | |
| 197 | self.dataset.save_testcases() |
| 198 | self.dataset.load_testcases() |
| 199 | self.verify_groundtruth(remove_instance=True) |
| 200 | self.dataset.save_testcases() |
| 201 | |
| 202 | |
| 203 | def fix_testcases(self, old_solution_file): |
nothing calls this directly
no test coverage detected