(line, include_answer=True)
| 84 | return model |
| 85 | |
| 86 | def format_example(line, include_answer=True): |
| 87 | example = line['question'] |
| 88 | for choice in choices: |
| 89 | example += f'\n{choice}. {line[f"{choice}"]}' |
| 90 | if include_answer: |
| 91 | example += '\n答案:' + line["answer"] + '\n\n' |
| 92 | else: |
| 93 | example += '\n答案:' |
| 94 | return example |
| 95 | |
| 96 | def generate_few_shot_prompt(subject, dev_df, ntrain=-1): |
| 97 | prompt = f"以下是中国关于{subject}考试的单项选择题,请选出其中的正确答案。\n\n" |
no outgoing calls
no test coverage detected