mgv99 commited on
Commit
915292f
1 Parent(s): 33fe8ba

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +57 -0
  2. config.json +32 -0
README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - google/gemma-2b-it
4
+ - google/codegemma-2b
5
+ license: apache-2.0
6
+ tags:
7
+ - moe
8
+ - frankenmoe
9
+ - merge
10
+ - mergekit
11
+ - google/gemma-2b-it
12
+ - google/codegemma-2b
13
+ ---
14
+
15
+ # gemma-2x2b
16
+
17
+ gemma-2x2b is a Mixture of Experts (MoE) made with the following models using [Mergekit](https://github.com/arcee-ai/mergekit):
18
+ * [google/gemma-2b-it](https://huggingface.co/google/gemma-2b-it)
19
+ * [google/codegemma-2b](https://huggingface.co/google/codegemma-2b)
20
+
21
+ ## 🧩 Configuration
22
+
23
+ ```yamlbase_model: mlabonne/Marcoro14-7B-slerp
24
+ experts:
25
+ - positive_prompts:
26
+ - chat
27
+ source_model: google/gemma-2b-it
28
+ - positive_prompts:
29
+ - code
30
+ source_model: google/codegemma-2b
31
+ experts_per_token: 2
32
+ gate_mode: hidden
33
+ ```
34
+
35
+ ## 💻 Usage
36
+
37
+ ```python
38
+ !pip install -qU transformers bitsandbytes accelerate
39
+
40
+ from transformers import AutoTokenizer
41
+ import transformers
42
+ import torch
43
+
44
+ model = "mgv99/gemma-2x2b"
45
+
46
+ tokenizer = AutoTokenizer.from_pretrained(model)
47
+ pipeline = transformers.pipeline(
48
+ "text-generation",
49
+ model=model,
50
+ model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
51
+ )
52
+
53
+ messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
54
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
55
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
56
+ print(outputs[0]["generated_text"])
57
+ ```
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "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": "bfloat16",
29
+ "transformers_version": "4.44.2",
30
+ "use_cache": true,
31
+ "vocab_size": 32000
32
+ }