Xiaojian9992024 commited on
Commit
45359c1
·
verified ·
1 Parent(s): 42f7b58

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - Qwen/Qwen2.5-0.5B-Instruct
5
+ - Qwen/Qwen2.5-Coder-0.5B
6
+ - funnyPhani/Qwen-2.5-0.5B-MATH
7
+ - caelancooper/Qwen2.5-0.5B-business
8
+ - KingNish/Qwen2.5-0.5b-Test-ft
9
+ tags:
10
+ - moe
11
+ - frankenmoe
12
+ - merge
13
+ - mergekit
14
+ - lazymergekit
15
+ - Qwen/Qwen2.5-0.5B-Instruct
16
+ - Qwen/Qwen2.5-Coder-0.5B
17
+ - funnyPhani/Qwen-2.5-0.5B-MATH
18
+ - caelancooper/Qwen2.5-0.5B-business
19
+ - KingNish/Qwen2.5-0.5b-Test-ft
20
+ ---
21
+
22
+ # LazyMergekit-Qwen2.5-0.5B-Mixtral
23
+
24
+ LazyMergekit-Qwen2.5-0.5B-Mixtral is a Mixture of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
25
+ * [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct)
26
+ * [Qwen/Qwen2.5-Coder-0.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B)
27
+ * [funnyPhani/Qwen-2.5-0.5B-MATH](https://huggingface.co/funnyPhani/Qwen-2.5-0.5B-MATH)
28
+ * [caelancooper/Qwen2.5-0.5B-business](https://huggingface.co/caelancooper/Qwen2.5-0.5B-business)
29
+ * [KingNish/Qwen2.5-0.5b-Test-ft](https://huggingface.co/KingNish/Qwen2.5-0.5b-Test-ft)
30
+
31
+ ## 🧩 Configuration
32
+
33
+ ```yaml
34
+ base_model: Qwen/Qwen2.5-0.5B-Instruct # Base model for shared layers
35
+ gate_mode: hidden # Use hidden representations for router initialization
36
+ dtype: float16 # Data type for the merged model
37
+
38
+ experts:
39
+ - source_model: Qwen/Qwen2.5-0.5B-Instruct
40
+ positive_prompts:
41
+ - "chat"
42
+ - "assistant"
43
+ - "tell me"
44
+ - "explain"
45
+ - "I want"
46
+ - source_model: Qwen/Qwen2.5-Coder-0.5B
47
+ positive_prompts:
48
+ - "code"
49
+ - "python"
50
+ - "javascript"
51
+ - "programming"
52
+ - "algorithm"
53
+ - source_model: funnyPhani/Qwen-2.5-0.5B-MATH
54
+ positive_prompts:
55
+ - "math"
56
+ - "mathematics"
57
+ - "solve"
58
+ - "count"
59
+ - "reason"
60
+ - source_model: caelancooper/Qwen2.5-0.5B-business
61
+ positive_prompts:
62
+ - "business"
63
+ - "finance"
64
+ - "market"
65
+ - "strategy"
66
+ - "analysis"
67
+ - source_model: KingNish/Qwen2.5-0.5b-Test-ft
68
+ positive_prompts:
69
+
70
+ ```
71
+
72
+ ## 💻 Usage
73
+
74
+ ```python
75
+ !pip install -qU transformers bitsandbytes accelerate
76
+
77
+ from transformers import AutoTokenizer
78
+ import transformers
79
+ import torch
80
+
81
+ model = "Xiaojian9992024/LazyMergekit-Qwen2.5-0.5B-Mixtral"
82
+
83
+ tokenizer = AutoTokenizer.from_pretrained(model)
84
+ pipeline = transformers.pipeline(
85
+ "text-generation",
86
+ model=model,
87
+ model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
88
+ )
89
+
90
+ messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
91
+ prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
92
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
93
+ print(outputs[0]["generated_text"])
94
+ ```