Skip to content

Commit 3b333a8

Browse files
committed
Fix(llm judge): Fix parameters; game name
1 parent 9f484ce commit 3b333a8

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

codeclash/analysis/llm_as_judge/get_instances.py

100644100755
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
args = parser.parse_args()
1616

1717
SELECTED_ROUNDS = [1, 2, 3, 5, 10, 12, 14, 15]
18-
SELECTED_GAMES = ["BattleSnake"] # Set to None to select all games
19-
NUMBER_OF_TOURNAMENTS = 3
18+
SELECTED_GAMES = None # ["BattleSnake"] # Set to None to select all games
19+
NUMBER_OF_TOURNAMENTS = 1
2020

2121
# first get all instances, then filter
2222
instances = sorted(get_instances(args.input_dir), key=lambda x: x.instance_id)
2323
print(f"Found {len(instances)} instances")
2424
if SELECTED_GAMES is not None:
25-
instances = [
26-
instance for instance in instances if any(game in instance.tournament_name for game in SELECTED_GAMES)
27-
]
25+
instances = [instance for instance in instances if instance.game_name in SELECTED_GAMES]
2826
print(f"Filtered to {len(instances)} instances because of game name")
2927
else:
3028
print("No game filtering applied (SELECTED_GAMES is None)")
@@ -36,7 +34,7 @@
3634
model_name_player, model_name_opponent = instance.get_lm_name_self_opponent()
3735
if model_name_player == model_name_opponent:
3836
continue
39-
key = (model_name_player, model_name_opponent, instance.round_number)
37+
key = (instance.game_name, model_name_player, model_name_opponent, instance.round_number)
4038
grouped[key].append(instance)
4139

4240
selected_instances = []

codeclash/analysis/llm_as_judge/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class Instance(BaseModel):
3030
tournament_name: str
3131
trajectory_path: Path
3232

33+
@property
34+
def game_name(self) -> str:
35+
return self.tournament_name.split(".")[1]
36+
3337
@property
3438
def instance_id(self) -> str:
3539
return f"{self.tournament_name}__{self.player_name}__r{self.round_number}"
@@ -78,11 +82,12 @@ def parse_trajectory_name(trajectory_path: Path) -> Instance:
7882
except:
7983
print(trajectory_path)
8084
raise
85+
tournament_name = trajectory_path.parent.parent.parent.name
8186
return Instance(
8287
trajectory_path=trajectory_path,
8388
player_name=trajectory_path.parent.name,
8489
round_number=round_number,
85-
tournament_name=trajectory_path.parent.parent.parent.name,
90+
tournament_name=tournament_name,
8691
)
8792

8893

0 commit comments

Comments
 (0)