Skip to content

Commit

Permalink
Merge pull request #36 from TranslatorSRI/fix_package
Browse files Browse the repository at this point in the history
Move config folder into package folder for pypi
  • Loading branch information
maximusunc authored Feb 15, 2024
2 parents c819935 + 9177ef9 commit 1d2544a
Show file tree
Hide file tree
Showing 50 changed files with 314 additions and 309 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Translator Benchmarks
# Translator Benchmarks Runner

This repository provides a set of benchmarks as well as the code to send the queries and evaluate the returned results of a benchmark.

`benchmarks` contains the code to query targets and evaluate results.
`benchmarks-runner` contains the code to query targets and evaluate results.

`config` contains the data sets, query templates, targets, and benchmark definitions necessary to run a benchmark. See `config/README.md` for details about targets and benchmarks.
`benchmarks-runner.config` contains the data sets, query templates, targets, and benchmark definitions necessary to run a benchmark. See `config/README.md` for details about targets and benchmarks.

## Usage
Running a benchmark is a two-step process:
1. Execute the queries of a benchmark and store the scored results.
2. Evaluate the scored results against the set of ground-truth relevant results.

[Installation](#installation) of the `benchmarks` package provides access to the functions and command-line interface necessary to run benchmarks.
[Installation](#installation) of the `benchmarks-runner` package provides access to the functions and command-line interface necessary to run benchmarks.
### CLI
The command-line interface is the easiest way to run a benchmark.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions benchmarks_runner/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def evaluate_results(
message = results_dir.get(uid, {}).get("message", {})

results_k = sorted(
message.get('results', []),
key=lambda r: r['analyses'][0].get('score', 0),
[] if message.get('results') is None else message['results'],
key=lambda r: r.get('analyses', [{ 'score': 0 }])[0].get('score', 0),
reverse=True
)[:k]

Expand Down
2 changes: 1 addition & 1 deletion benchmarks_runner/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def run_benchmarks(
output_imgs[target] = imgs
output_results.extend(output_result)

return output_results, imgs
return output_results, output_imgs


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion benchmarks_runner/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import pathlib

PROJECT_DIR = pathlib.Path(__file__).resolve().parent.parent.parent
PROJECT_DIR = pathlib.Path(__file__).resolve().parent.parent
CONFIG_DIR = PROJECT_DIR / 'config'

with open(CONFIG_DIR / 'benchmarks.json', 'r') as file:
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from setuptools import find_packages, setup

with open("README.md", encoding="utf-8") as readme_file:
Expand All @@ -12,7 +13,11 @@
description="Translator Benchmarks Runner",
long_description_content_type="text/markdown",
long_description=readme,
package_data={'benchmarks_runnner': ['config/*']},
# include all config files
package_data={'benchmarks-runner': [
'config/**/*.json',
'config/**/data.tsv',
]},
include_package_data=True,
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 1d2544a

Please sign in to comment.