eval-tasks / preprocess_triviaqa.py
CultriX's picture
Upload folder using huggingface_hub
6afe180 verified
raw
history blame contribute delete
276 Bytes
def doc_to_text(doc) -> str:
question = doc['question']
choices = ""
for idx, choice in enumerate(doc['answer']['aliases']):
if idx >= 5:
break
letter = "ABCDE"[idx]
choices+= f"{letter}. {choice}\n"
return f"Question: {question}\n{choices}Answer:"