Download process_data.py from zhwang4ai/GenerativeReasoningBenchmark: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/spaces/zhwang4ai/GenerativeReasoningBenchmark/resolve/main/process_data.py
- Command line
-
hf download hf://spaces/zhwang4ai/GenerativeReasoningBenchmark/process_data.py
-
curl -L -o process_data.py https://huggingface.co/spaces/zhwang4ai/GenerativeReasoningBenchmark/resolve/main/process_data.py
2.29 kB
| import pandas as pd | |
| import json | |
| hard_data_path = 'data/hard_0402.json' | |
| easy_data_path = 'data/easy_0402.json' | |
| average_success_rate_file_path = 'data/success_rate_0402.json' | |
| average_action_count_file_path = 'data/action_count_0402.json' | |
| def load_average_data(): | |
| with open(average_success_rate_file_path, 'r') as f: | |
| average_success_rate_data = json.load(f) | |
| with open(average_action_count_file_path, 'r') as f: | |
| average_action_count_data = json.load(f) | |
| average_success_rate = average_success_rate_data['Average'] | |
| average_action_count = average_action_count_data['Average'] | |
| df = pd.DataFrame({ | |
| 'Success Rate ↑ (100 Average)': average_success_rate, | |
| 'Action Count ↓ (100 Average)': average_action_count | |
| }) | |
| return df | |
| def load_detailed_success_rate_data(): | |
| with open(average_success_rate_file_path, 'r') as f: | |
| detailed_success_rate_data = json.load(f) | |
| df = pd.DataFrame(detailed_success_rate_data) | |
| # df = df.T # 转置为 model 是行,指标是列 | |
| return df | |
| def load_detailed_action_counts_data(): | |
| with open(average_action_count_file_path, 'r') as f: | |
| detailed_action_counts_data = json.load(f) | |
| df = pd.DataFrame(detailed_action_counts_data) | |
| # df = df.T # 转置为 model 是行,指标是列 | |
| return df | |
| def load_hard_data(): | |
| with open(hard_data_path, 'r') as f: | |
| hard_data = json.load(f) | |
| df = pd.DataFrame(hard_data) | |
| df = df.T # 转置为 model 是行,指标是列 | |
| df.rename(columns={'success_rate':'Success Rate ↑ (Hard)', 'relative_action_count':'Action Count ↓ (Hard)'}, inplace=True) | |
| return df | |
| def load_easy_data(): | |
| with open(easy_data_path, 'r') as f: | |
| hard_data = json.load(f) | |
| df = pd.DataFrame(hard_data) | |
| df = df.T # 转置为 model 是行,指标是列 | |
| df.rename(columns={'success_rate':'Success Rate ↑ (Easy)', 'relative_action_count':'Action Count ↓ (Easy)'}, inplace=True) | |
| return df | |
| if __name__ == '__main__': | |
| # average_df = load_average_data() | |
| # hard_df = load_hard_data() | |
| # easy_df = load_easy_data() | |
| # import ipdb; ipdb.set_trace() | |
| # df = pd.concat([average_df, hard_df, easy_df], axis=1) | |
| # print(df) | |
| df = load_detailed_success_rate_data() | |
| print(df) | |