mwitiderrick
commited on
Commit
•
f47bf45
1
Parent(s):
ec92a23
Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,27 @@
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
## Training procedure
|
5 |
|
6 |
|
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
---
|
4 |
+
## Usage
|
5 |
+
|
6 |
+
```python
|
7 |
+
from peft import PeftModel, PeftConfig
|
8 |
+
from transformers import AutoModelForCausalLM
|
9 |
+
|
10 |
+
config = PeftConfig.from_pretrained("mwitiderrick/zephyr-7b-beta-gsm8k")
|
11 |
+
model = AutoModelForCausalLM.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
|
12 |
+
model = PeftModel.from_pretrained(model, "mwitiderrick/zephyr-7b-beta-gsm8k")
|
13 |
+
|
14 |
+
prompt = "James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week?"
|
15 |
+
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=200)
|
16 |
+
result = pipe(f"<s>[INST] {prompt} [/INST]")
|
17 |
+
print(result[0]['generated_text'])
|
18 |
+
|
19 |
+
"""
|
20 |
+
<s>[INST] James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week? [/INST] He runs 3*3=<<3*3=9>>9 sprints a week
|
21 |
+
So he runs 9*60=<<9*60=540>>540 meters a week
|
22 |
+
"""
|
23 |
+
|
24 |
+
```
|
25 |
## Training procedure
|
26 |
|
27 |
|