Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- Open-Orca/OpenOrca
|
4 |
+
---
|
5 |
+
|
6 |
+
To use, do:
|
7 |
+
|
8 |
+
```
|
9 |
+
from peft import PeftModel, PeftConfig
|
10 |
+
from transformers import AutoTokenizer
|
11 |
+
ref_model = AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-70m-deduped-v0", torch_dtype=torch.bfloat16)
|
12 |
+
peft_model_id = "w601sxs/pythia-70m-instruct-orca-chkpt-64000"
|
13 |
+
|
14 |
+
config = PeftConfig.from_pretrained(peft_model_id)
|
15 |
+
model = PeftModel.from_pretrained(ref_model, peft_model_id)
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
17 |
+
|
18 |
+
model = model.to('cuda:0')
|
19 |
+
model.eval()
|
20 |
+
|
21 |
+
|
22 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
23 |
+
|
24 |
+
with torch.no_grad():
|
25 |
+
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=10)
|
26 |
+
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0]
|
27 |
+
|
28 |
+
|
29 |
+
```
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
### Prompt format
|
35 |
+
|
36 |
+
```
|
37 |
+
context: < ... >
|
38 |
+
question: < ... >
|
39 |
+
answer: < ... >
|
40 |
+
```
|
41 |
+
|
42 |
+
For e.g.
|
43 |
+
|
44 |
+
"context: <You are an AI assistant. You will be given a task. You must generate a detailed and long answer.>\n question: <Just when we thought Pharrell Williams couldn’t get any cooler, he becomes the first guy to star in Chanel ’s upcoming handbag campaign. Williams has already appeared in a short video by Karl Lagerfeld and even walked the Chanel runway, and now he’s modelling the Gabrielle bag from the fashion house’s spring collection. Set to join Kristen Stewart, Caroline de Maigret and Cara Delevingne in the campaign - with Lagerfeld taking on the role of photographer - Williams star turn is set to debut on Monday 3 April.\n\nBased on that paragraph can we conclude that this sentence is true?\nLagerfeld will be taking pictures of the event where Pharrell along with three others in the fourth month of the year.\n\nChoose from:\n a). Yes;\n b). It's impossible to say;\n c). No;>\n "
|