Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,49 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
library_name: transformers
|
7 |
+
tags:
|
8 |
+
- moe
|
9 |
+
- merge
|
10 |
+
- llama-3
|
11 |
---
|
12 |
+
Bombus_3x8B is a Mixture of Experts (MoE) (Llama-3).
|
13 |
+
|
14 |
+
## Usage
|
15 |
+
|
16 |
+
```python
|
17 |
+
!pip install -qU transformers bitsandbytes accelerate
|
18 |
+
|
19 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
20 |
+
import transformers
|
21 |
+
import torch
|
22 |
+
|
23 |
+
model_id = "Eurdem/Bombus_3x8B"
|
24 |
+
|
25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(
|
27 |
+
model_id,
|
28 |
+
torch_dtype=torch.float16,
|
29 |
+
device_map="auto",
|
30 |
+
load_in_4bit= True
|
31 |
+
)
|
32 |
+
|
33 |
+
messages = [
|
34 |
+
{"role": "system", "content": "You are a helpful chatbot who always responds friendly."},
|
35 |
+
{"role": "user", "content": "tell me about yourself"},
|
36 |
+
]
|
37 |
+
|
38 |
+
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
|
39 |
+
|
40 |
+
outputs = model.generate(input_ids,
|
41 |
+
max_new_tokens=1024,
|
42 |
+
do_sample=True,
|
43 |
+
temperature=0.7,
|
44 |
+
top_p=0.7,
|
45 |
+
top_k=500,
|
46 |
+
)
|
47 |
+
response = outputs[0][input_ids.shape[-1]:]
|
48 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
49 |
+
```
|