Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- moe
|
5 |
+
- mergekit
|
6 |
+
- merge
|
7 |
+
- chinese
|
8 |
+
- arabic
|
9 |
+
- english
|
10 |
+
- multilingual
|
11 |
+
- german
|
12 |
+
- french
|
13 |
+
- jondurbin/bagel-dpo-34b-v0.2
|
14 |
+
- jondurbin/nontoxic-bagel-34b-v0.2
|
15 |
+
---
|
16 |
+
|
17 |
+
# MetaModel_moe_yix2
|
18 |
+
|
19 |
+
This model is a Mixure of Experts (MoE) made with [mergekit](https://github.com/cg123/mergekit) (mixtral branch). It uses the following base models:
|
20 |
+
* [jondurbin/bagel-dpo-34b-v0.2](https://huggingface.co/jondurbin/bagel-dpo-34b-v0.2)
|
21 |
+
* [jondurbin/nontoxic-bagel-34b-v0.2](https://huggingface.co/jondurbin/nontoxic-bagel-34b-v0.2)
|
22 |
+
|
23 |
+
## 🧩 Configuration
|
24 |
+
|
25 |
+
```yamlbase_model: jondurbin/bagel-dpo-34b-v0.2
|
26 |
+
dtype: bfloat16
|
27 |
+
experts:
|
28 |
+
- positive_prompts:
|
29 |
+
- chat
|
30 |
+
- assistant
|
31 |
+
- tell me
|
32 |
+
- explain
|
33 |
+
source_model: jondurbin/bagel-dpo-34b-v0.2
|
34 |
+
- positive_prompts:
|
35 |
+
- chat
|
36 |
+
- assistant
|
37 |
+
- tell me
|
38 |
+
- explain
|
39 |
+
source_model: jondurbin/nontoxic-bagel-34b-v0.2
|
40 |
+
gate_mode: hidden
|
41 |
+
```
|
42 |
+
|
43 |
+
## 💻 Usage
|
44 |
+
|
45 |
+
```python
|
46 |
+
!pip install -qU transformers bitsandbytes accelerate
|
47 |
+
|
48 |
+
from transformers import AutoTokenizer
|
49 |
+
import transformers
|
50 |
+
import torch
|
51 |
+
|
52 |
+
model = "gagan3012/MetaModel_moe_yix2"
|
53 |
+
|
54 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
55 |
+
pipeline = transformers.pipeline(
|
56 |
+
"text-generation",
|
57 |
+
model=model,
|
58 |
+
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
59 |
+
)
|
60 |
+
|
61 |
+
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
62 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
63 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
64 |
+
print(outputs[0]["generated_text"])
|
65 |
+
```
|