Spaces:
Running
Running
openhands
commited on
Commit
·
aa07520
1
Parent(s):
b5df580
Fix null columns by mapping source data to expected column names
Browse files- Modified simple_data_loader.py to use lowercase column names that match transformer expectations
- Changed agent_name → agent, llm_base → models used, tool_usage → agent tooling, submission_time → date
- Fixed leaderboard_transformer.py tag map capitalization to match column names
- All 24 columns now populated correctly (no null values)
- Resolves JavaScript table rendering error
- leaderboard_transformer.py +3 -1
- simple_data_loader.py +64 -1
leaderboard_transformer.py
CHANGED
|
@@ -146,7 +146,9 @@ def create_pretty_tag_map(raw_tag_map: dict, name_map: dict) -> dict:
|
|
| 146 |
pretty_map = {}
|
| 147 |
# Helper to get pretty name with a fallback
|
| 148 |
def get_pretty(raw_name):
|
| 149 |
-
|
|
|
|
|
|
|
| 150 |
|
| 151 |
key_order = ORDER_MAP.get('Overall_keys', [])
|
| 152 |
sorted_keys = sorted(raw_tag_map.keys(), key=lambda x: key_order.index(x) if x in key_order else len(key_order))
|
|
|
|
| 146 |
pretty_map = {}
|
| 147 |
# Helper to get pretty name with a fallback
|
| 148 |
def get_pretty(raw_name):
|
| 149 |
+
result = name_map.get(raw_name, raw_name.replace("_", " "))
|
| 150 |
+
# Title case the result to match how _pretty_column_name works
|
| 151 |
+
return result.title().replace(' ', '-') if '-' in raw_name else result.title()
|
| 152 |
|
| 153 |
key_order = ORDER_MAP.get('Overall_keys', [])
|
| 154 |
sorted_keys = sorted(raw_tag_map.keys(), key=lambda x: key_order.index(x) if x in key_order else len(key_order))
|
simple_data_loader.py
CHANGED
|
@@ -69,9 +69,72 @@ class SimpleLeaderboardViewer:
|
|
| 69 |
"Message": [f"No data in file: {jsonl_file}"]
|
| 70 |
}), {}
|
| 71 |
|
|
|
|
| 72 |
df = pd.DataFrame(records)
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
except Exception as e:
|
|
|
|
|
|
|
| 75 |
return pd.DataFrame({
|
| 76 |
"Message": [f"Error loading data: {e}"]
|
| 77 |
}), {}
|
|
|
|
| 69 |
"Message": [f"No data in file: {jsonl_file}"]
|
| 70 |
}), {}
|
| 71 |
|
| 72 |
+
# Convert to DataFrame
|
| 73 |
df = pd.DataFrame(records)
|
| 74 |
+
|
| 75 |
+
# Transform to expected format for leaderboard
|
| 76 |
+
# Group by agent to aggregate results across datasets
|
| 77 |
+
transformed_records = []
|
| 78 |
+
|
| 79 |
+
for agent_name in df['agent_name'].unique():
|
| 80 |
+
agent_records = df[df['agent_name'] == agent_name]
|
| 81 |
+
|
| 82 |
+
# Build a single record for this agent
|
| 83 |
+
first_record = agent_records.iloc[0]
|
| 84 |
+
record = {
|
| 85 |
+
# Core agent info - use final display names
|
| 86 |
+
'agent': agent_name, # Will become "Agent" after prettifying
|
| 87 |
+
'models used': first_record['llm_base'], # Will become "Models Used"
|
| 88 |
+
'openness': first_record['openness'], # Will become "Openness"
|
| 89 |
+
'agent tooling': first_record['tool_usage'], # Will become "Agent Tooling"
|
| 90 |
+
'date': first_record['submission_time'], # Will become "Date"
|
| 91 |
+
# Additional columns expected by the transformer
|
| 92 |
+
'id': first_record.get('id', agent_name), # Will become "Id"
|
| 93 |
+
'submitter': first_record.get('submitter', 'Unknown'), # Will become "Submitter"
|
| 94 |
+
'source': first_record.get('source', ''), # Will become "Source"
|
| 95 |
+
'logs': first_record.get('logs', ''), # Will become "Logs"
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
# Add per-dataset scores and costs
|
| 99 |
+
dataset_scores = []
|
| 100 |
+
dataset_costs = []
|
| 101 |
+
|
| 102 |
+
for _, row in agent_records.iterrows():
|
| 103 |
+
tags = row['tags'] if isinstance(row['tags'], list) else [row['tags']]
|
| 104 |
+
for tag in tags:
|
| 105 |
+
# Add columns for this specific dataset
|
| 106 |
+
record[f'{tag} score'] = row['score']
|
| 107 |
+
record[f'{tag} cost'] = row['total_cost']
|
| 108 |
+
dataset_scores.append(row['score'])
|
| 109 |
+
dataset_costs.append(row['total_cost'])
|
| 110 |
+
|
| 111 |
+
# Calculate overall score and cost (average across datasets)
|
| 112 |
+
if dataset_scores:
|
| 113 |
+
record['overall score'] = sum(dataset_scores) / len(dataset_scores)
|
| 114 |
+
record['overall cost'] = sum(dataset_costs) / len(dataset_costs)
|
| 115 |
+
else:
|
| 116 |
+
record['overall score'] = None
|
| 117 |
+
record['overall cost'] = None
|
| 118 |
+
|
| 119 |
+
transformed_records.append(record)
|
| 120 |
+
|
| 121 |
+
transformed_df = pd.DataFrame(transformed_records)
|
| 122 |
+
|
| 123 |
+
# Build tag map if not already built
|
| 124 |
+
if not self.tag_map:
|
| 125 |
+
# Create simple tag map from the data
|
| 126 |
+
all_tags = set()
|
| 127 |
+
for _, row in df.iterrows():
|
| 128 |
+
tags = row['tags'] if isinstance(row['tags'], list) else [row['tags']]
|
| 129 |
+
all_tags.update(tags)
|
| 130 |
+
|
| 131 |
+
# Simple mapping: each tag maps to itself
|
| 132 |
+
self.tag_map = {tag: [tag] for tag in sorted(all_tags)}
|
| 133 |
+
|
| 134 |
+
return transformed_df, self.tag_map
|
| 135 |
except Exception as e:
|
| 136 |
+
import traceback
|
| 137 |
+
traceback.print_exc()
|
| 138 |
return pd.DataFrame({
|
| 139 |
"Message": [f"Error loading data: {e}"]
|
| 140 |
}), {}
|