Llamoe-test / README.md
damerajee's picture
Upload folder using huggingface_hub
fd40f56 verified
|
raw
history blame
2.58 kB
---
license: apache-2.0
tags:
- moe
- frankenmoe
- merge
- mergekit
- lazymergekit
- meta-llama/Llama-2-7b-hf
- syzymon/long_llama_code_7b_instruct
- georgesung/llama2_7b_chat_uncensored
- togethercomputer/LLaMA-2-7B-32K
base_model:
- meta-llama/Llama-2-7b-hf
- syzymon/long_llama_code_7b_instruct
- georgesung/llama2_7b_chat_uncensored
- togethercomputer/LLaMA-2-7B-32K
---
# Llamoe-test
Llamoe-test is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
* [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)
* [syzymon/long_llama_code_7b_instruct](https://huggingface.co/syzymon/long_llama_code_7b_instruct)
* [georgesung/llama2_7b_chat_uncensored](https://huggingface.co/georgesung/llama2_7b_chat_uncensored)
* [togethercomputer/LLaMA-2-7B-32K](https://huggingface.co/togethercomputer/LLaMA-2-7B-32K)
## 🧩 Configuration
```yaml
base_model: meta-llama/Llama-2-7b-chat-hf
gate_mode: random
dtype: bfloat16
experts_per_token: 2
experts:
- source_model: meta-llama/Llama-2-7b-hf
positive_prompts:
- "should be able to converse properly"
negative_prompts:
- "Uncensored in my opinion"
- source_model: syzymon/long_llama_code_7b_instruct
positive_prompts:
- "Perform pretty well in coding question"
negative_prompts:
- "Is quite bad in C++"
- source_model: georgesung/llama2_7b_chat_uncensored
positive_prompts:
- "Uncensored"
negative_prompts:
- "really bad in high school grade math and science"
- source_model: togethercomputer/LLaMA-2-7B-32K
positive_prompts:
- "really good in long context question answering"
negative_prompts:
- "incorrect or biased content"
```
## 💻 Usage
```python
!pip install -qU transformers bitsandbytes accelerate
from transformers import AutoTokenizer
import transformers
import torch
model = "damerajee/Llamoe-test"
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"])
```