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