Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- Sentdex/WSB-003.004
|
5 |
+
pipeline_tag: text-generation
|
6 |
---
|
7 |
+
|
8 |
+
Probably don't use this model, I'm just tinkering, but it's a multi-turn, multi-speaker model attempt trained from /r/wallstreetbets data that you can find: https://huggingface.co/datasets/Sentdex/WSB-003.004
|
9 |
+
|
10 |
+
```py
|
11 |
+
#https://huggingface.co/docs/peft/quicktour
|
12 |
+
|
13 |
+
from peft import AutoPeftModelForCausalLM
|
14 |
+
from transformers import AutoTokenizer
|
15 |
+
import torch
|
16 |
+
|
17 |
+
model = AutoPeftModelForCausalLM.from_pretrained("Sentdex/Walls1337bot-Llama2-7B-003.004.3900")
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
|
19 |
+
|
20 |
+
model = model.to("cuda")
|
21 |
+
model.eval()
|
22 |
+
|
23 |
+
prompt = "Your text here."
|
24 |
+
formatted_prompt = f"### BEGIN CONVERSATION ###\n\n## Speaker_0: ##\n{prompt}\n\n## Walls1337bot: ##\n"
|
25 |
+
inputs = tokenizer(formatted_prompt, return_tensors="pt")
|
26 |
+
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=128)
|
27 |
+
text_output =
|
28 |
+
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0])
|
29 |
+
```
|