Sentdex commited on
Commit
55f697e
1 Parent(s): 0bdc62e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md CHANGED
@@ -1,3 +1,23 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ ```py
6
+ #https://huggingface.co/docs/peft/quicktour
7
+
8
+ from peft import AutoPeftModelForCausalLM
9
+ from transformers import AutoTokenizer
10
+ import torch
11
+
12
+ model = AutoPeftModelForCausalLM.from_pretrained("Sentdex/Walls1337bot-Llama2-7B-003.004.400")
13
+ tokenizer = AutoTokenizer.from_pretrained("NousResearch/Llama-2-7b-chat-hf")
14
+
15
+ model = model.to("cuda")
16
+ model.eval()
17
+
18
+ formatted_prompt = f"### BEGIN CONVERSATION ###\n\n## Speaker_0: ##\n{prompt}\n\n## Walls1337bot: ##\n"
19
+ inputs = tokenizer(formatted_prompt, return_tensors="pt")
20
+ outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=128)
21
+ text_output =
22
+ print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0])
23
+ ```