shuvom commited on
Commit
1458581
1 Parent(s): 086b21b

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +54 -0
  2. config.json +30 -0
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - moe
5
+ - merge
6
+ - mergekit
7
+ - lazymergekit
8
+ - mistralai/Mistral-7B-Instruct-v0.2
9
+ - OpenPipe/mistral-ft-optimized-1218
10
+ ---
11
+
12
+ # my-mixtral-2x7B
13
+
14
+ my-mixtral-2x7B is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
15
+ * [mistralai/Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)
16
+ * [OpenPipe/mistral-ft-optimized-1218](https://huggingface.co/OpenPipe/mistral-ft-optimized-1218)
17
+
18
+ ## 🧩 Configuration
19
+
20
+ ```yaml
21
+ base_model: mistralai/Mistral-7B-Instruct-v0.2
22
+ gate_mode: cheap_embed
23
+ experts:
24
+ - source_model: mistralai/Mistral-7B-Instruct-v0.2
25
+ positive_prompts:
26
+ - "chat"
27
+ - "assistant"
28
+ - source_model: OpenPipe/mistral-ft-optimized-1218
29
+ positive_prompts: [""]
30
+ ```
31
+
32
+ ## 💻 Usage
33
+
34
+ ```python
35
+ !pip install -qU transformers bitsandbytes accelerate
36
+
37
+ from transformers import AutoTokenizer
38
+ import transformers
39
+ import torch
40
+
41
+ model = "shuvom/my-mixtral-2x7B"
42
+
43
+ tokenizer = AutoTokenizer.from_pretrained(model)
44
+ pipeline = transformers.pipeline(
45
+ "text-generation",
46
+ model=model,
47
+ model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
48
+ )
49
+
50
+ messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
51
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
52
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
53
+ print(outputs[0]["generated_text"])
54
+ ```
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "mistralai/Mistral-7B-Instruct-v0.2",
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": 1000000.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.36.2",
28
+ "use_cache": true,
29
+ "vocab_size": 32000
30
+ }