yukiontheiceberg
commited on
Commit
•
b3a134a
1
Parent(s):
43cea23
Update README.md
Browse files
README.md
CHANGED
@@ -5,4 +5,21 @@ license: apache-2.0
|
|
5 |
|
6 |
blurb
|
7 |
|
8 |
-
<center><img src="k2_chat_eval_table.png" alt="k2 eval table" /></center>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
blurb
|
7 |
|
8 |
+
<center><img src="k2_chat_eval_table.png" alt="k2 eval table" /></center>
|
9 |
+
|
10 |
+
## Loading K2-Chat
|
11 |
+
# Loading K2
|
12 |
+
```python
|
13 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
14 |
+
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained("LLM360/K2-Chat")
|
16 |
+
model = AutoModelForCausalLM.from_pretrained("LLM360/K2-Chat")
|
17 |
+
|
18 |
+
prompt = 'hi how are you doing'
|
19 |
+
|
20 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
21 |
+
gen_tokens = model.generate(input_ids, do_sample=True, max_length=128)
|
22 |
+
|
23 |
+
print("-"*20 + "Output for model" + 20 * '-')
|
24 |
+
print(tokenizer.batch_decode(gen_tokens)[0])
|
25 |
+
```
|