google / langfun

OO for LLMs
Apache License 2.0
122 stars 18 forks source link

Eval framework: Write `summary.json` for easy access of metrics by programs. #170

Closed copybara-service[bot] closed 5 months ago

copybara-service[bot] commented 5 months ago

Eval framework: Write summary.json for easy access of metrics by programs.

Example:

r = pg.load('/path/to/summary.json', force_dict=True)
for task_name, task_results in r.items():
  print(task_name):
  for tr in task_results:
    print('PROMPT', tr.experiment.prompt.template_str)
    if tr.metrics is not None: # Finished experiment.
      print('ACCURACY', tr.metrics.match_rate)

NOTE: Users could either do pg.load('/path/to/summary.json) to load the results with original experiment definition (require importing dependent code), or use pg.load('/path/to/summary.json', force_dict=True) to load the experiment definition and output as dicts, without import experiment definition.