AdaptLLM-4x7B-MoE / README.md
Isotonic's picture
Upload folder using huggingface_hub
f0635bb verified
|
raw
history blame
No virus
2.83 kB
---
license: apache-2.0
tags:
- moe
- merge
- mergekit
- lazymergekit
- mlabonne/NeuralBeagle14-7B
- AdaptLLM/finance-chat
- AdaptLLM/medicine-chat
- AdaptLLM/law-chat
---
# AdaptLLM-4x7B-MoE
AdaptLLM-4x7B-MoE is a Mixure of Experts (MoE) made with the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
* [mlabonne/NeuralBeagle14-7B](https://huggingface.co/mlabonne/NeuralBeagle14-7B)
* [AdaptLLM/finance-chat](https://huggingface.co/AdaptLLM/finance-chat)
* [AdaptLLM/medicine-chat](https://huggingface.co/AdaptLLM/medicine-chat)
* [AdaptLLM/law-chat](https://huggingface.co/AdaptLLM/law-chat)
## 🧩 Configuration
```yaml
base_model: mlabonne/NeuralBeagle14-7B
experts:
- source_model: mlabonne/NeuralBeagle14-7B
positive_prompts:
- "chat"
- "assistant"
- "tell me"
- "explain"
- "storywriting"
- "write"
- "scene"
- "story"
- "character"
- "instruct"
- "summarize"
- "count"
- source_model: AdaptLLM/finance-chat
positive_prompts:
- "personal finance"
- "budgeting"
- "investing"
- "retirement planning"
- "debt management"
- "financial education"
- "consumer protection"
- "financial"
- "money"
- "investment"
- "banking"
- "stock"
- "bond"
- "portfolio"
- "risk"
- "return"
- source_model: AdaptLLM/medicine-chat
positive_prompts:
- "diagnose"
- "treat"
- "disease"
- "symptom"
- "medication"
- "anatomy"
- "physiology"
- "pharmacology"
- "clinical trial"
- "medical research"
- source_model: AdaptLLM/law-chat
positive_prompts:
- "law"
- "legal"
- "attorney"
- "lawyer"
- "court"
- "contract"
- "criminal"
- "evidence"
- "procedure"
- "contracts"
- "mergers & acquisitions"
- "corporate governance"
- "intellectual property"
- "employment law"
- "international trade"
- "competition law"
- "antitrust"
- "litigation"
- "arbitration"
- "mediation"
```
## 💻 Usage
```python
!pip install -qU transformers bitsandbytes accelerate
from transformers import AutoTokenizer
import transformers
import torch
model = "Isotonic/AdaptLLM-4x7B-MoE"
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"])
```