Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- sw
|
4 |
+
---
|
5 |
+
|
6 |
+
```python
|
7 |
+
alpaca_prompt = """Hapo chini kuna maelezo ya kazi, pamoja na maelezo ya ziada yanayotoa muktadha zaidi. Andika jibu ambalo linakamilisha ombi hilo ipasavyo.
|
8 |
+
|
9 |
+
### Maelezo:
|
10 |
+
{}
|
11 |
+
|
12 |
+
### Ziada:
|
13 |
+
{}
|
14 |
+
|
15 |
+
### Jibu:
|
16 |
+
{}"""
|
17 |
+
EOS_TOKEN = tokenizer.eos_token # Must add EOS_TOKEN
|
18 |
+
def formatting_prompts_func(examples):
|
19 |
+
instructions = examples["instruction"]
|
20 |
+
inputs = examples["input"]
|
21 |
+
outputs = examples["output"]
|
22 |
+
texts = []
|
23 |
+
for instruction, input, output in zip(instructions, inputs, outputs):
|
24 |
+
# Must add EOS_TOKEN, otherwise your generation will go on forever!
|
25 |
+
text = alpaca_prompt.format(instruction, input, output) + EOS_TOKEN
|
26 |
+
texts.append(text)
|
27 |
+
return { "text" : texts, }
|
28 |
+
pass
|
29 |
+
|
30 |
+
from datasets import load_dataset
|
31 |
+
|
32 |
+
|
33 |
+
```
|