(example)
| 61 | |
| 62 | |
| 63 | def format_alpaca(example): |
| 64 | if example.get("input", ""): |
| 65 | return ( |
| 66 | f"### Instruction:\n{example['instruction']}\n\n" |
| 67 | f"### Input:\n{example['input']}\n\n" |
| 68 | f"### Response:\n{example['output']}" |
| 69 | ) |
| 70 | return f"### Instruction:\n{example['instruction']}\n\n### Response:\n{example['output']}" |
| 71 | |
| 72 | |
| 73 | def prepare_data(tokenizer, dataset_name, max_length, num_samples=200): |