LazyMergekit-Qwen2.5-0.5B-Mixtral
LazyMergekit-Qwen2.5-0.5B-Mixtral is a Mixture of Experts (MoE) made with the following models using LazyMergekit:
- Qwen/Qwen2.5-0.5B-Instruct
- Qwen/Qwen2.5-Coder-0.5B
- funnyPhani/Qwen-2.5-0.5B-MATH
- caelancooper/Qwen2.5-0.5B-business
- KingNish/Qwen2.5-0.5b-Test-ft
𧩠Configuration
base_model: Qwen/Qwen2.5-0.5B-Instruct # Base model for shared layers
gate_mode: hidden # Use hidden representations for router initialization
dtype: float16 # Data type for the merged model
experts:
- source_model: Qwen/Qwen2.5-0.5B-Instruct
positive_prompts:
- "chat"
- "assistant"
- "tell me"
- "explain"
- "I want"
- source_model: Qwen/Qwen2.5-Coder-0.5B
positive_prompts:
- "code"
- "python"
- "javascript"
- "programming"
- "algorithm"
- source_model: funnyPhani/Qwen-2.5-0.5B-MATH
positive_prompts:
- "math"
- "mathematics"
- "solve"
- "count"
- "reason"
- source_model: caelancooper/Qwen2.5-0.5B-business
positive_prompts:
- "business"
- "finance"
- "market"
- "strategy"
- "analysis"
- source_model: KingNish/Qwen2.5-0.5b-Test-ft
positive_prompts:
π» Usage
!pip install -qU transformers bitsandbytes accelerate
from transformers import AutoTokenizer
import transformers
import torch
model = "Xiaojian9992024/LazyMergekit-Qwen2.5-0.5B-Mixtral"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
)
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])