Skip to content

Commit 006a8f1

Browse files
committed
Add handling for multiple qwen model names
1 parent 991b967 commit 006a8f1

17 files changed

Lines changed: 66 additions & 17 deletions

codeclash/analysis/metrics/win_rate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def main(log_dir: Path):
3535
metadata = json.load(open(game_log_folder / "metadata.json"))
3636
try:
3737
player_to_model = {
38-
x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]
38+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
39+
for x in metadata["config"]["players"]
3940
}
4041
except KeyError:
4142
continue

codeclash/analysis/stats/per_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def main(log_dir: str):
107107
with open(game_log_folder / "metadata.json") as f:
108108
metadata = json.load(f)
109109
try:
110-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
110+
p2m = {
111+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
112+
for x in metadata["config"]["players"]
113+
}
111114
except KeyError:
112115
continue
113116

codeclash/analysis/viz/cdf_command_diversity.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def main():
134134
metadata = json.load(f)
135135
try:
136136
# Extract mapping from player name to model name
137-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
137+
p2m = {
138+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
139+
for x in metadata["config"]["players"]
140+
}
138141
# Initialize diversity list for each model we encounter
139142
for model in p2m.values():
140143
if model not in model_to_diversity:

codeclash/analysis/viz/cdf_files_edited_per_round.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ def main():
2121
with open(game_log_folder / "metadata.json") as f:
2222
metadata = json.load(f)
2323
try:
24-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
24+
p2m = {
25+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
26+
for x in metadata["config"]["players"]
27+
}
2528
for model in p2m.values():
2629
if model not in model_to_num_files:
2730
model_to_num_files[model] = []

codeclash/analysis/viz/cdf_steps_per_round.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ def main():
2020
with open(game_log_folder / "metadata.json") as f:
2121
metadata = json.load(f)
2222
try:
23-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
23+
p2m = {
24+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
25+
for x in metadata["config"]["players"]
26+
}
2427
for model in p2m.values():
2528
if model not in model_to_steps:
2629
model_to_steps[model] = []

codeclash/analysis/viz/cdf_thought_length_per_round.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ def main():
2121
with open(game_log_folder / "metadata.json") as f:
2222
metadata = json.load(f)
2323
try:
24-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
24+
p2m = {
25+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
26+
for x in metadata["config"]["players"]
27+
}
2528
for model in p2m.values():
2629
if model not in model_to_steps:
2730
model_to_steps[model] = []

codeclash/analysis/viz/heatmap_returncode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def main(logs: Path):
2323
with open(game_log_folder / "metadata.json") as f:
2424
metadata = json.load(f)
2525
try:
26-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
26+
p2m = {
27+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
28+
for x in metadata["config"]["players"]
29+
}
2730
for model in p2m.values():
2831
if model not in model_to_arena_to_return_codes:
2932
model_to_arena_to_return_codes[model] = {}

codeclash/analysis/viz/heatmap_win_rates.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def main(log_dir: Path):
2424
for metadata_file in tqdm(list(log_dir.rglob("metadata.json"))):
2525
try:
2626
metadata = json.load(open(metadata_file))
27-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
27+
p2m = {
28+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
29+
for x in metadata["config"]["players"]
30+
}
2831

2932
if len(p2m) != 2:
3033
continue

codeclash/analysis/viz/heatmap_win_streak_distribution.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ def main(log_dir: Path, xlim: int = 15):
2121
for metadata_file in tqdm(list(log_dir.rglob("metadata.json")), desc="Processing tournaments"):
2222
try:
2323
metadata = json.load(open(metadata_file))
24-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
24+
p2m = {
25+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
26+
for x in metadata["config"]["players"]
27+
}
2528

2629
if len(p2m) != 2:
2730
continue

codeclash/analysis/viz/line_chart_model_resiliency.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ def analyze_tournament_directory(log_dir):
156156
player_names = [p["name"] for p in players]
157157

158158
# Create player-to-model mapping (consistent with other analysis scripts)
159-
p2m = {x["name"]: x["config"]["model"]["model_name"].strip("@") for x in metadata["config"]["players"]}
159+
p2m = {
160+
x["name"]: x["config"]["model"]["model_name"].strip("@").split("/")[-1]
161+
for x in metadata["config"]["players"]
162+
}
160163

161164
# Skip if not exactly 2 players (PvP tournament)
162165
if len(player_names) != 2:

0 commit comments

Comments
 (0)