Spaces:
Configuration error
Configuration error
Download evaluation/benchmarks/agent_bench/scripts/summarise_results.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/evaluation/benchmarks/agent_bench/scripts/summarise_results.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/evaluation/benchmarks/agent_bench/scripts/summarise_results.py
-
curl -L -o summarise_results.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/evaluation/benchmarks/agent_bench/scripts/summarise_results.py
1.2 kB
| import json | |
| import sys | |
| def extract_test_results(res_file_path: str) -> tuple[list[str], list[str]]: | |
| passed = [] | |
| failed = [] | |
| with open(res_file_path, 'r') as file: | |
| for line in file: | |
| data = json.loads(line.strip()) | |
| instance_id = data['instance_id'] | |
| resolved = False | |
| if 'test_result' in data and 'result' in data['test_result']: | |
| resolved = data['test_result']['result'] | |
| if resolved: | |
| passed.append(instance_id) | |
| else: | |
| failed.append(instance_id) | |
| return passed, failed | |
| if __name__ == '__main__': | |
| if len(sys.argv) != 2: | |
| print( | |
| 'Usage: poetry run python summarise_results.py <path_to_output_jsonl_file>' | |
| ) | |
| sys.exit(1) | |
| json_file_path = sys.argv[1] | |
| passed_tests, failed_tests = extract_test_results(json_file_path) | |
| succ_rate = len(passed_tests) / (len(passed_tests) + len(failed_tests)) | |
| print( | |
| f'\nPassed {len(passed_tests)} tests, failed {len(failed_tests)} tests, resolve rate = {succ_rate}' | |
| ) | |
| print('PASSED TESTS:') | |
| print(passed_tests) | |
| print('FAILED TESTS:') | |
| print(failed_tests) | |