(path: str)
| 74 | |
| 75 | |
| 76 | def load_model_answer(path: str) -> dict[str, str]: |
| 77 | df = pd.read_json(path, lines=True) |
| 78 | if "question_id" in df.columns and "choices" in df.columns: |
| 79 | return { |
| 80 | row["question_id"]: row["choices"][0]["turns"][0] |
| 81 | for _, row in df.iterrows() |
| 82 | } |
| 83 | elif "id" in df.columns and "generated_text" in df.columns: |
| 84 | return {int(row["id"])+1: row["generated_text"] for _, row in df.iterrows()} |
| 85 | else: |
| 86 | raise ValueError("Unknown format") |
| 87 | |
| 88 | |
| 89 |