(args)
| 166 | writer.write(x) |
| 167 | |
| 168 | def main(args): |
| 169 | |
| 170 | path_split = args.pretrained_path.split('/') |
| 171 | if path_split[-1] == '': |
| 172 | path_split.pop(-1) |
| 173 | model_name = path_split[-1] |
| 174 | infer_path = os.path.join('results', model_name, 'humaneval/infer') |
| 175 | os.makedirs(infer_path, exist_ok=True) |
| 176 | eval_path = os.path.join('results', model_name, 'humaneval/eval') |
| 177 | os.makedirs(eval_path, exist_ok=True) |
| 178 | |
| 179 | model = load(args) |
| 180 | |
| 181 | infer_file = os.path.join(infer_path, 'human_infer.jsonl') |
| 182 | run_infer(model, infer_file, args.overwrite,) |
| 183 | |
| 184 | torch.distributed.barrier() |
| 185 | if torch.distributed.get_rank() == 0: |
| 186 | |
| 187 | print("Evaluating...") |
| 188 | score = entry_point(sample_file=infer_file) |
| 189 | |
| 190 | with open(os.path.join(eval_path, 'run_results.json'), 'w') as f: |
| 191 | json.dump(score, f, ensure_ascii=False, indent=2) |
| 192 | print(score) |
| 193 | |
| 194 | |
| 195 | if __name__ == "__main__": |
no test coverage detected