
# Trinary

Trinary is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
* [Undi95/Borealis-10.7B-DPO](https://huggingface.co/Undi95/Borealis-10.7B-DPO)
* [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0)

## 🧩 Configuration

```yaml
base_model: NousResearch/Nous-Hermes-2-SOLAR-10.7B
gate_mode: hidden # one of "hidden", "cheap_embed", or "random"
dtype: bfloat16 # output dtype (float32, float16, or bfloat16)
experts:
  - source_model: Undi95/Borealis-10.7B-DPO
    positive_prompts:
    - "chat"
    - "assistant"
    - "tell me"
    - "explain"
    - "roleplay"
  - source_model: upstage/SOLAR-10.7B-Instruct-v1.0
    positive_prompts:
    - "solve"
    - "count"
    - "math"
    - "mathematics"
    - "algorithm"
    - "reason"    
```

## 💻 Usage

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

from transformers import AutoTokenizer
import transformers
import torch

model = "LunaticPython161/Trinary"

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"])
```
{"license": "apache-2.0", "tags": ["moe", "frankenmoe", "merge", "mergekit", "lazymergekit", "Undi95/Borealis-10.7B-DPO", "upstage/SOLAR-10.7B-Instruct-v1.0"], "base_model": ["Undi95/Borealis-10.7B-DPO", "upstage/SOLAR-10.7B-Instruct-v1.0"]}
transformers safetensors mixtral text-generation moe frankenmoe merge mergekit lazymergekit Undi95/Borealis-10.7B-DPO upstage/SOLAR-10.7B-Instruct-v1.0 conversational base_model:Undi95/Borealis-10.7B-DPO base_model:upstage/SOLAR-10.7B-Instruct-v1.0 license:apache-2.0 autotrain_compatible endpoints_compatible text-generation-inference region:us