|
--- |
|
license: cc-by-nc-4.0 |
|
tags: |
|
- merge |
|
- mergekit |
|
- lazymergekit |
|
- automerger |
|
--- |
|
|
|
## 🧩 Configuration |
|
```yaml |
|
#slices: |
|
# - sources: |
|
# - model: liminerity/M7-7b |
|
# layer_range: [0, 32] |
|
# - model: AurelPx/Percival_01-7b-slerp |
|
# layer_range: [0, 32] |
|
#merge_method: slerp |
|
#base_model: liminerity/M7-7b |
|
#parameters: |
|
# t: |
|
# - filter: self_attn |
|
# value: [0.10671682864418519, 0.2587429682722914, 0.7254855120576987, 0.36811557880904033, 0.01600047241283964] |
|
# - filter: mlp |
|
# value: [0.8932831713558148, 0.7412570317277086, 0.6318844211909597, 0.6318844211909597, 0.9839995275871604] |
|
# - value: 0.6580019418208543 |
|
#dtype: bfloat16 |
|
#random_seed: 0 |
|
|
|
#slices: |
|
# - sources: |
|
# - model: psmathur/orca_mini_v3_13b |
|
# layer_range: [0, 40] |
|
# - model: garage-bAInd/Platypus2-7b |
|
# layer_range: [0, 32] |
|
#merge_method: slerp |
|
#base_model: psmathur/orca_mini_v3_13b |
|
#parameters: |
|
# t: |
|
# - filter: self_attn |
|
# value: [0.10671682864418519, 0.2587429682722914, 0.7254855120576987, 0.36811557880904033, 0.01600047241283964] |
|
# - filter: mlp |
|
# value: [0.8932831713558148, 0.7412570317277086, 0.27451448794230127, 0.6318844211909597, 0.9839995275871604] |
|
# - value: 0.6580019418208543 |
|
#dtype: float16 |
|
#random_seed: 0 |
|
|
|
#slices: |
|
# - sources: |
|
# - model: psmathur/orca_mini_v3_13b |
|
# parameters: |
|
# density: [1, 0.7, 0.1] # density gradient |
|
# weight: 1.0 |
|
# - model: garage-bAInd/Platypus2-13B |
|
# parameters: |
|
# density: 0.5 |
|
# weight: [0, 0.3, 0.7, 1] # weight gradient |
|
# - model: WizardLM/WizardMath-13B-V1.0 |
|
# parameters: |
|
# density: 0.33 |
|
# weight: |
|
# - filter: mlp |
|
# value: 0.5 |
|
# - value: 0 |
|
#merge_method: ties |
|
#base_model: TheBloke/Llama-2-13B-fp16 |
|
#parameters: |
|
# normalize: true |
|
# int8_mask: true |
|
#dtype: float16 |
|
#random_seed: 0 |
|
|
|
base_model: mlabonne/AlphaMonarch-7B |
|
experts: |
|
- source_model: mlabonne/AlphaMonarch-7B |
|
positive_prompts: |
|
- "chat" |
|
- "assistant" |
|
- "tell me" |
|
- "explain" |
|
- "I want" |
|
- source_model: TheBloke/Llama-2-13B-fp16 |
|
positive_prompts: |
|
- "reason" |
|
- "math" |
|
- "mathematics" |
|
- "solve" |
|
- "count" |
|
``` |
|
## 💻 Usage |
|
```python |
|
!pip install -qU transformers accelerate |
|
from transformers import AutoTokenizer |
|
import transformers |
|
import torch |
|
model = "EthanLiu1991/Merged_model_MoE" |
|
messages = [{"role": "user", "content": "What is a large language model?"}] |
|
tokenizer = AutoTokenizer.from_pretrained(model) |
|
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
|
pipeline = transformers.pipeline( |
|
"text-generation", |
|
model=model, |
|
torch_dtype=torch.float16, |
|
device_map="auto", |
|
) |
|
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"]) |
|
``` |