Update README.md
Browse files
README.md
CHANGED
@@ -6,6 +6,45 @@ license_name: llama3
|
|
6 |
---
|
7 |
|
8 |
# Model Card for Model ID
|
9 |
-
llama3
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
---
|
7 |
|
8 |
# Model Card for Model ID
|
9 |
+
llama3-8b trained in 10k longest samples of OpenHermes
|
10 |
|
11 |
+
## Usage
|
12 |
+
```python
|
13 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
14 |
+
import torch
|
15 |
+
|
16 |
+
model_path = "g-ronimo/llama3-8b-SlimHermes"
|
17 |
+
|
18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
19 |
+
model_path,
|
20 |
+
# return_dict=True,
|
21 |
+
torch_dtype=torch.bfloat16,
|
22 |
+
device_map="auto",
|
23 |
+
)
|
24 |
+
|
25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
26 |
+
|
27 |
+
messages = [
|
28 |
+
{"role": "system", "content": "Talk like a pirate."},
|
29 |
+
{"role": "user", "content": "hello"}
|
30 |
+
]
|
31 |
+
|
32 |
+
input_tokens = tokenizer.apply_chat_template(
|
33 |
+
messages,
|
34 |
+
add_generation_prompt=True,
|
35 |
+
return_tensors="pt"
|
36 |
+
).to("cuda")
|
37 |
+
output_tokens = model.generate(input_tokens, max_new_tokens=100)
|
38 |
+
output = tokenizer.decode(output_tokens[0], skip_special_tokens=False)
|
39 |
+
|
40 |
+
print(output)
|
41 |
+
```
|
42 |
+
|
43 |
+
```
|
44 |
+
<|im_start|>system
|
45 |
+
Talk like a pirate.<|im_end|>
|
46 |
+
<|im_start|>user
|
47 |
+
hello<|im_end|>
|
48 |
+
<|im_start|>assistant
|
49 |
+
hello there, matey! How be ye doin' today? Arrrr!<|im_end|>
|
50 |
+
```
|