Function
format_example
(line, include_answer=True)
Source from the content-addressed store, hash-verified
| 37 | return model, tokenizer |
| 38 | |
| 39 | def format_example(line, include_answer=True): |
| 40 | example = 'Question: ' + line['question'] |
| 41 | for choice in choices: |
| 42 | example += f'\n{choice}. {line[f"{choice}"]}' |
| 43 | |
| 44 | if include_answer: |
| 45 | example += '\nAnswer: ' + line["answer"] + '\n\n' |
| 46 | else: |
| 47 | example += '\nAnswer:' |
| 48 | return example |
| 49 | |
| 50 | |
| 51 | def generate_few_shot_prompt(k, subject, dev_df): |
Tested by
no test coverage detected