ntotsuka123
commited on
Commit
•
6104483
1
Parent(s):
9dbcdc7
Upload folder using huggingface_hub
Browse files- README.md +65 -0
- config.json +32 -0
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model:
|
4 |
+
- mlabonne/AlphaMonarch-7B
|
5 |
+
- beowolx/CodeNinja-1.0-OpenChat-7B
|
6 |
+
tags:
|
7 |
+
- moe
|
8 |
+
- frankenmoe
|
9 |
+
- merge
|
10 |
+
- mergekit
|
11 |
+
- lazymergekit
|
12 |
+
- mlabonne/AlphaMonarch-7B
|
13 |
+
- beowolx/CodeNinja-1.0-OpenChat-7B
|
14 |
+
---
|
15 |
+
|
16 |
+
# MoE_AlphaMonarch_CodeNinja
|
17 |
+
|
18 |
+
MoE_AlphaMonarch_CodeNinja is a Mixture of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
19 |
+
* [mlabonne/AlphaMonarch-7B](https://huggingface.co/mlabonne/AlphaMonarch-7B)
|
20 |
+
* [beowolx/CodeNinja-1.0-OpenChat-7B](https://huggingface.co/beowolx/CodeNinja-1.0-OpenChat-7B)
|
21 |
+
|
22 |
+
## 🧩 Configuration
|
23 |
+
|
24 |
+
```yaml
|
25 |
+
base_model: mlabonne/AlphaMonarch-7B
|
26 |
+
experts:
|
27 |
+
- source_model: mlabonne/AlphaMonarch-7B
|
28 |
+
positive_prompts:
|
29 |
+
- "chat"
|
30 |
+
- "assistant"
|
31 |
+
- "tell me"
|
32 |
+
- "explain"
|
33 |
+
- "I want"
|
34 |
+
- source_model: beowolx/CodeNinja-1.0-OpenChat-7B
|
35 |
+
positive_prompts:
|
36 |
+
- "code"
|
37 |
+
- "python"
|
38 |
+
- "javascript"
|
39 |
+
- "programming"
|
40 |
+
- "algorithm"
|
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 = "ntotsuka123/MoE_AlphaMonarch_CodeNinja"
|
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 |
+
```
|
config.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "mlabonne/AlphaMonarch-7B",
|
3 |
+
"architectures": [
|
4 |
+
"MixtralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"head_dim": 128,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 4096,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 14336,
|
14 |
+
"max_position_embeddings": 32768,
|
15 |
+
"model_type": "mixtral",
|
16 |
+
"num_attention_heads": 32,
|
17 |
+
"num_experts_per_tok": 2,
|
18 |
+
"num_hidden_layers": 32,
|
19 |
+
"num_key_value_heads": 8,
|
20 |
+
"num_local_experts": 2,
|
21 |
+
"output_router_logits": false,
|
22 |
+
"rms_norm_eps": 1e-05,
|
23 |
+
"rope_theta": 10000.0,
|
24 |
+
"router_aux_loss_coef": 0.001,
|
25 |
+
"router_jitter_noise": 0.0,
|
26 |
+
"sliding_window": null,
|
27 |
+
"tie_word_embeddings": false,
|
28 |
+
"torch_dtype": "float16",
|
29 |
+
"transformers_version": "4.47.1",
|
30 |
+
"use_cache": true,
|
31 |
+
"vocab_size": 32000
|
32 |
+
}
|