andrijdavid
commited on
Commit
•
474e750
1
Parent(s):
02b2a01
Update README.md
Browse files
README.md
CHANGED
@@ -5,23 +5,15 @@ library_name: transformers
|
|
5 |
tags:
|
6 |
- mergekit
|
7 |
- merge
|
8 |
-
|
|
|
|
|
9 |
---
|
10 |
# Meta-Llama-3-13B-Instruct
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
## Merge Details
|
15 |
-
### Merge Method
|
16 |
-
|
17 |
-
This model was merged using the passthrough merge method.
|
18 |
-
|
19 |
-
### Models Merged
|
20 |
|
21 |
-
|
22 |
-
* [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
|
23 |
-
|
24 |
-
### Configuration
|
25 |
|
26 |
The following YAML configuration was used to produce this model:
|
27 |
|
@@ -40,3 +32,47 @@ merge_method: passthrough
|
|
40 |
dtype: float16
|
41 |
|
42 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
tags:
|
6 |
- mergekit
|
7 |
- merge
|
8 |
+
license: other
|
9 |
+
language:
|
10 |
+
- en
|
11 |
---
|
12 |
# Meta-Llama-3-13B-Instruct
|
13 |
|
14 |
+
Meta-Llama-3-13B-Instruct is a [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) self-merge made with [MergeKit](https://github.com/arcee-ai/mergekit/tree/main).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
## Configuration
|
|
|
|
|
|
|
17 |
|
18 |
The following YAML configuration was used to produce this model:
|
19 |
|
|
|
32 |
dtype: float16
|
33 |
|
34 |
```
|
35 |
+
|
36 |
+
## Usage
|
37 |
+
|
38 |
+
```python
|
39 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
40 |
+
import torch
|
41 |
+
|
42 |
+
model_id = "andrijdavid/Meta-Llama-3-13B-Instruct"
|
43 |
+
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
45 |
+
model = AutoModelForCausalLM.from_pretrained(
|
46 |
+
model_id,
|
47 |
+
torch_dtype=torch.bfloat16,
|
48 |
+
device_map="auto",
|
49 |
+
)
|
50 |
+
|
51 |
+
messages = [
|
52 |
+
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
53 |
+
{"role": "user", "content": "Who are you?"},
|
54 |
+
]
|
55 |
+
|
56 |
+
input_ids = tokenizer.apply_chat_template(
|
57 |
+
messages,
|
58 |
+
add_generation_prompt=True,
|
59 |
+
return_tensors="pt"
|
60 |
+
).to(model.device)
|
61 |
+
|
62 |
+
terminators = [
|
63 |
+
tokenizer.eos_token_id,
|
64 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
65 |
+
]
|
66 |
+
|
67 |
+
outputs = model.generate(
|
68 |
+
input_ids,
|
69 |
+
max_new_tokens=256,
|
70 |
+
eos_token_id=terminators,
|
71 |
+
do_sample=True,
|
72 |
+
temperature=0.6,
|
73 |
+
top_p=0.9,
|
74 |
+
)
|
75 |
+
response = outputs[0][input_ids.shape[-1]:]
|
76 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
77 |
+
|
78 |
+
```
|