mgv99 commited on
Commit
1b201f1
1 Parent(s): 59b906a

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +64 -0
  2. config.json +30 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - moe
5
+ - frankenmoe
6
+ - merge
7
+ - mergekit
8
+ - lazymergekit
9
+ - openchat/openchat-3.5-1210
10
+ - beowolx/CodeNinja-1.0-OpenChat-7B
11
+ base_model:
12
+ - openchat/openchat-3.5-1210
13
+ - beowolx/CodeNinja-1.0-OpenChat-7B
14
+ ---
15
+
16
+ # mistral-moe
17
+
18
+ mistral-moe is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
19
+ * [openchat/openchat-3.5-1210](https://huggingface.co/openchat/openchat-3.5-1210)
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/Marcoro14-7B-slerp
26
+ experts:
27
+ - source_model: openchat/openchat-3.5-1210
28
+ positive_prompts:
29
+ - "chat"
30
+ - "assistant"
31
+ - "tell me"
32
+ - "explain"
33
+ - source_model: beowolx/CodeNinja-1.0-OpenChat-7B
34
+ positive_prompts:
35
+ - "code"
36
+ - "python"
37
+ - "javascript"
38
+ - "programming"
39
+ - "algorithm"
40
+ ```
41
+
42
+ ## 💻 Usage
43
+
44
+ ```python
45
+ !pip install -qU transformers bitsandbytes accelerate
46
+
47
+ from transformers import AutoTokenizer
48
+ import transformers
49
+ import torch
50
+
51
+ model = "mgv99/mistral-moe"
52
+
53
+ tokenizer = AutoTokenizer.from_pretrained(model)
54
+ pipeline = transformers.pipeline(
55
+ "text-generation",
56
+ model=model,
57
+ model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
58
+ )
59
+
60
+ messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
61
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
62
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
63
+ print(outputs[0]["generated_text"])
64
+ ```
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "mlabonne/Marcoro14-7B-slerp",
3
+ "architectures": [
4
+ "MixtralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 4096,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 14336,
13
+ "max_position_embeddings": 32768,
14
+ "model_type": "mixtral",
15
+ "num_attention_heads": 32,
16
+ "num_experts_per_tok": 2,
17
+ "num_hidden_layers": 32,
18
+ "num_key_value_heads": 8,
19
+ "num_local_experts": 2,
20
+ "output_router_logits": false,
21
+ "rms_norm_eps": 1e-05,
22
+ "rope_theta": 10000.0,
23
+ "router_aux_loss_coef": 0.001,
24
+ "sliding_window": null,
25
+ "tie_word_embeddings": false,
26
+ "torch_dtype": "bfloat16",
27
+ "transformers_version": "4.38.2",
28
+ "use_cache": true,
29
+ "vocab_size": 32000
30
+ }