likenneth commited on
Commit
fc4558b
·
1 Parent(s): b664cd3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+
5
+ You can load and play around starting from below:
6
+
7
+ ```python
8
+ import torch
9
+ from pprint import pprint
10
+ from transformers import AutoConfig, AutoTokenizer, AutoModelForCausalLM
11
+
12
+ model_name_new = "likenneth/honest_llama2_chat_7B"
13
+ tokenizer_new = AutoTokenizer.from_pretrained(model_name_new, trust_remote_code=True)
14
+ model_new = AutoModelForCausalLM.from_pretrained(model_name_new, low_cpu_mem_usage = True, torch_dtype=torch.float16, trust_remote_code=True)
15
+ _ = model_new.cuda()
16
+
17
+ q = "I ate a cherry seed. Will a cherry tree grow in my stomach?"
18
+ encoded_new = tokenizer_new(q, return_tensors = "pt")["input_ids"]
19
+ generated_new = model_new.generate(encoded_new.cuda())[0, encoded_new.shape[-1]:]
20
+ decoded_new = tokenizer_new.decode(generated_new, skip_special_tokens=True).strip()
21
+ pprint(decoded_new)
22
+ ```