Merged_model_MoE / README.md
EthanLiu1991's picture
Upload folder using huggingface_hub
455576c verified
metadata
license: cc-by-nc-4.0
tags:
  - merge
  - mergekit
  - lazymergekit
  - automerger

🧩 Configuration

#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.6606117722434863, 0.01708760797547526, 0.8948656675765086, 0.47128075561315386, 0.5692245310177902]
#    - filter: mlp
#      value: [0.33938822775651367, 0.9829123920245247, 0.5287192443868461, 0.5287192443868461, 0.43077546898220975]
#    - value: 0.14995989969007373
#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.6606117722434863, 0.01708760797547526, 0.8948656675765086, 0.47128075561315386, 0.5692245310177902]
#    - filter: mlp
#      value: [0.33938822775651367, 0.9829123920245247, 0.10513433242349135, 0.5287192443868461, 0.43077546898220975]
#    - value: 0.14995989969007373
#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"])