transformers safetensors llama text-generation moe mergekit conversational en license:apache-2.0 autotrain_compatible endpoints_compatible text-generation-inference region:us
---
license: apache-2.0
tags:
- moe
- mergekit
language:
- en
metrics:
- accuracy
pipeline_tag: text-generation
---


## 🧩 Configuration

```yaml 
slices:
  - sources:
      - model: SUSTech/SUS-Chat-34B
        layer_range: [0, 60]
      - model: jondurbin/bagel-dpo-34b-v0.2
        layer_range: [0, 60]
merge_method: slerp
base_model: jondurbin/bagel-dpo-34b-v0.2
parameters:
  t:
    - filter: self_attn
      value: [0, 0.5, 0.3, 0.7, 1]
    - filter: mlp
      value: [1, 0.5, 0.7, 0.3, 0]
    - value: 0.5
dtype: bfloat16
```

## 💻 Usage

```python
!pip install -qU transformers bitsandbytes accelerate

from transformers import AutoTokenizer
import transformers
import torch

model = "chenhugging/Yi-2x34B-Merge-Slerp"

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"])
```