Download reference/code/dMoE/evaluations/evaluation/arc/prompt.py from Ouzhang/hku_diffusion_dllm: direct link, hf CLI and curl.
- Browser
- Download file 729 Bytes
-
https://huggingface.co/Ouzhang/hku_diffusion_dllm/resolve/main/reference/code/dMoE/evaluations/evaluation/arc/prompt.py
- Command line
-
hf download hf://Ouzhang/hku_diffusion_dllm/reference/code/dMoE/evaluations/evaluation/arc/prompt.py
-
curl -L -o prompt.py https://huggingface.co/Ouzhang/hku_diffusion_dllm/resolve/main/reference/code/dMoE/evaluations/evaluation/arc/prompt.py
729 Bytes
| import os | |
| from collections import defaultdict | |
| from typing import Any | |
| import io | |
| import numpy as np | |
| from tqdm import tqdm | |
| QUERY_TEMPLATE_MULTICHOICE = """ | |
| Answer the following multiple choice question. Think step by step and then give the final answer of the following format: \\boxed{{$LETTER}} where LETTER is one of ABCD. | |
| {Question} | |
| A) {A} | |
| B) {B} | |
| C) {C} | |
| D) {D} | |
| """.strip() | |
| def format_prompt(row: dict): | |
| choices = row["choices"]["text"] | |
| choices = choices + ["NA"] * (4 - len(choices)) | |
| prompt_messages = QUERY_TEMPLATE_MULTICHOICE.format( | |
| Question=row["question"], | |
| A=choices[0], | |
| B=choices[1], | |
| C=choices[2], | |
| D=choices[3], | |
| ) | |
| return prompt_messages, row["answerKey"] |