MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / main

Function main

light-eval/src/eval_math.py:199–225  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

197 return score, invalid_outputs
198
199def main(args):
200
201 path_split = args.pretrained_path.split('/')
202 if path_split[-1] == '':
203 path_split.pop(-1)
204 model_name = path_split[-1]
205 infer_path = os.path.join('results', model_name, 'math/infer')
206 os.makedirs(infer_path, exist_ok=True)
207 eval_path = os.path.join('results', model_name, 'math/eval')
208 os.makedirs(eval_path, exist_ok=True)
209
210 model = load(args)
211
212 run_infer(model, args.max_seq_len, args.data_dir, infer_path, args.overwrite)
213
214 torch.distributed.barrier()
215 if torch.distributed.get_rank() == 0:
216
217 score, invalid_outputs = run_eval(infer_path)
218
219 with open(os.path.join(eval_path, 'run_results.json'), 'w') as f:
220 json.dump(score, f, ensure_ascii=False, indent=2)
221
222 with open(os.path.join(eval_path, 'debug_invalid_outputs.jsonl'), 'w') as outfile:
223 for entry in invalid_outputs:
224 json.dump(entry, outfile, ensure_ascii=False,indent=2)
225 outfile.write('\n')
226
227if __name__ == "__main__":
228

Callers 1

eval_math.pyFile · 0.70

Calls 3

loadFunction · 0.70
run_inferFunction · 0.70
run_evalFunction · 0.70

Tested by

no test coverage detected