Skip to content

Commit 239bdef

Browse files
committed
Include qna_file in mt_bench_branch results
Signed-off-by: Dan McPherson <[email protected]>
1 parent f79ce58 commit 239bdef

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/instructlab/eval/mt_bench_judgment.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,32 @@ def make_judgment(
105105
answer_df = pd.read_json(answer_file, lines=True)
106106

107107
# Join to get questions with answers
108+
join_columns = ["question_id", "choices", "turns", "category"]
109+
if bench_name == "mt_bench_branch":
110+
join_columns.append("qna_file")
111+
108112
joined_df = question_df.join(
109113
answer_df.set_index("question_id"), on="question_id", rsuffix="_answer"
110-
)[["question_id", "choices", "turns", "category"]]
114+
)[join_columns]
111115
# Join to get scores
116+
join_columns.append("score")
112117
joined_df = judgment_df_all.join(
113118
joined_df.set_index("question_id"), on="question_id", lsuffix="_judgment"
114-
)[["question_id", "choices", "turns", "score", "category"]]
119+
)[join_columns]
115120
joined_df = joined_df[joined_df["score"] != -1]
116121

117122
qa_pairs = []
118123
for _, row in joined_df.iterrows():
119-
qa_pairs.append(
120-
{
121-
"question_id": row["question_id"],
122-
"score": row["score"],
123-
"category": row["category"],
124-
"question": row["turns"],
125-
"answer": row["choices"],
126-
}
127-
)
124+
qa_pair = {
125+
"question_id": row["question_id"],
126+
"score": row["score"],
127+
"category": row["category"],
128+
"question": row["turns"],
129+
"answer": row["choices"],
130+
}
131+
if bench_name == "mt_bench_branch":
132+
qa_pair["qna_file"] = row["qna_file"]
133+
qa_pairs.append(qa_pair)
128134
return overall_score, qa_pairs, turn_scores
129135

130136

0 commit comments

Comments
 (0)