(self, codegen = False, chat = False)
| 54 | |
| 55 | |
| 56 | def get_solutions(self, codegen = False, chat = False): |
| 57 | for index, prompt in enumerate(self.outputs): |
| 58 | if prompt not in self.dataset.prompt2instance: |
| 59 | print('Cannot find the prompt of instance #{} in dataset, skipped.'.format(index)) |
| 60 | continue |
| 61 | instance = self.dataset.prompt2instance[prompt] |
| 62 | solutions = [] |
| 63 | if not self.outputs[prompt][1]: |
| 64 | continue |
| 65 | if not isinstance(self.outputs[prompt][0], list): |
| 66 | print(self.outputs[prompt][0]) |
| 67 | continue |
| 68 | for code in self.outputs[prompt][0]: |
| 69 | solution = sanitize(code, self.get_entrypoint(instance), codegen = codegen, global_code = True if self.dataset.name in ["NTU-NLP-sg/xCodeEval", "codeparrot/apps"] else False, chat = chat) |
| 70 | solution = self.process_solution(solution, instance) |
| 71 | if solution not in solutions: |
| 72 | solutions.append(solution) |
| 73 | |
| 74 | self.solutions[prompt] = solutions |
| 75 | |
| 76 | |
| 77 | def save_solutions(self): |
nothing calls this directly
no test coverage detected