Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark script fixes #1301

Merged
merged 4 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions guides/benchmarks/glue.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
python benchmark_submission_formatter.py \
--benchmark GLUE \
--input_base_path $INPUT_BASE_PATH \
--output_path $OUTPUT_BASE PATH
--output_path $OUTPUT_BASE_PATH
```

where `$INPUT_BASE_PATH` contains the task folder(s) output by [runscript.py](https://github.com/jiant-dev/jiant/blob/master/jiant/proj/main/runscript.py). Alternatively, a subset of tasks can be formatted using:
Expand All @@ -18,5 +18,5 @@ python benchmark_submission_formatter.py \
--benchmark GLUE \
--tasks cola mrpc \
--input_base_path $INPUT_BASE_PATH \
--output_path $OUTPUT_BASE PATH
--output_path $OUTPUT_BASE_PATH
```
4 changes: 2 additions & 2 deletions guides/benchmarks/superglue.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
python benchmark_submission_formatter.py \
--benchmark SUPERGLUE \
--input_base_path $INPUT_BASE_PATH \
--output_path $OUTPUT_BASE PATH
--output_path $OUTPUT_BASE_PATH
```

where `$INPUT_BASE_PATH` contains the task folder(s) output by [runscript.py](https://github.com/nyu-mll/jiant/blob/master/jiant/proj/main/runscript.py). Alternatively, a subset of tasks can be formatted using:
Expand All @@ -16,5 +16,5 @@ python benchmark_submission_formatter.py \
--benchmark SUPERGLUE \
--tasks cola mrpc \
--input_base_path $INPUT_BASE_PATH \
--output_path $OUTPUT_BASE PATH
--output_path $OUTPUT_BASE_PATH
```
8 changes: 4 additions & 4 deletions jiant/scripts/benchmarks/benchmark_submission_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import argparse

from jiant.scripts.postproc.benchmarks import GlueBenchmark, SuperglueBenchmark
from jiant.scripts.benchmarks.benchmarks import GlueBenchmark, SuperglueBenchmark


SUPPORTED_BENCHMARKS = {"GLUE": GlueBenchmark, "SUPERGLUE": SuperglueBenchmark}
Expand All @@ -17,7 +17,7 @@ def main():
parser.add_argument(
"--input_base_path",
required=True,
help="base input path of benchmark task predictions (contains the benchmark task folders)",
help="base path where per-task folders contain raw prediction files",
)
parser.add_argument("--output_path", required=True, help="output path for formatted files")
parser.add_argument(
Expand All @@ -31,15 +31,15 @@ def main():
benchmark = SUPPORTED_BENCHMARKS[args.benchmark]

if args.tasks:
assert args.tasks in benchmark.TASKS
assert set(args.tasks) <= benchmark.TASKS
task_names = args.tasks
else:
task_names = benchmark.TASKS

for task_name in task_names:
input_filepath = os.path.join(args.input_base_path, task_name, "test_preds.p")
output_filepath = os.path.join(
args.output_path, benchmark.BENCHMARK_SUBMISSION_FILENAMES[task_name]
os.path.abspath(args.output_path), benchmark.BENCHMARK_SUBMISSION_FILENAMES[task_name]
)
benchmark.write_predictions(task_name, input_filepath, output_filepath)

Expand Down