Update README.md
Browse files
README.md
CHANGED
|
@@ -9,6 +9,12 @@ tags:
|
|
| 9 |
- AdaptLLM/finance-chat
|
| 10 |
- AdaptLLM/medicine-chat
|
| 11 |
- AdaptLLM/law-chat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# AdaptLLM-4x7B-MoE
|
|
@@ -19,6 +25,37 @@ AdaptLLM-4x7B-MoE is a Mixure of Experts (MoE) made with the following models us
|
|
| 19 |
* [AdaptLLM/medicine-chat](https://huggingface.co/AdaptLLM/medicine-chat)
|
| 20 |
* [AdaptLLM/law-chat](https://huggingface.co/AdaptLLM/law-chat)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
## 🧩 Configuration
|
| 23 |
|
| 24 |
```yaml
|
|
@@ -93,28 +130,4 @@ experts:
|
|
| 93 |
- "litigation"
|
| 94 |
- "arbitration"
|
| 95 |
- "mediation"
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
## 💻 Usage
|
| 99 |
-
|
| 100 |
-
```python
|
| 101 |
-
!pip install -qU transformers bitsandbytes accelerate
|
| 102 |
-
|
| 103 |
-
from transformers import AutoTokenizer
|
| 104 |
-
import transformers
|
| 105 |
-
import torch
|
| 106 |
-
|
| 107 |
-
model = "Isotonic/AdaptLLM-4x7B-MoE"
|
| 108 |
-
|
| 109 |
-
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 110 |
-
pipeline = transformers.pipeline(
|
| 111 |
-
"text-generation",
|
| 112 |
-
model=model,
|
| 113 |
-
model_kwargs={"torch_dtype": torch.float16, "load_in_4bit": True},
|
| 114 |
-
)
|
| 115 |
-
|
| 116 |
-
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
| 117 |
-
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 118 |
-
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 119 |
-
print(outputs[0]["generated_text"])
|
| 120 |
```
|
|
|
|
| 9 |
- AdaptLLM/finance-chat
|
| 10 |
- AdaptLLM/medicine-chat
|
| 11 |
- AdaptLLM/law-chat
|
| 12 |
+
datasets:
|
| 13 |
+
- Open-Orca/OpenOrca
|
| 14 |
+
- WizardLM/WizardLM_evol_instruct_V2_196k
|
| 15 |
+
- EleutherAI/pile
|
| 16 |
+
- GAIR/lima
|
| 17 |
+
pipeline_tag: text-generation
|
| 18 |
---
|
| 19 |
|
| 20 |
# AdaptLLM-4x7B-MoE
|
|
|
|
| 25 |
* [AdaptLLM/medicine-chat](https://huggingface.co/AdaptLLM/medicine-chat)
|
| 26 |
* [AdaptLLM/law-chat](https://huggingface.co/AdaptLLM/law-chat)
|
| 27 |
|
| 28 |
+
## 💻 Usage
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
!pip install -qU transformers bitsandbytes accelerate
|
| 32 |
+
|
| 33 |
+
from transformers import AutoTokenizer
|
| 34 |
+
import transformers
|
| 35 |
+
import torch
|
| 36 |
+
|
| 37 |
+
model = "Isotonic/AdaptLLM-4x7B-MoE"
|
| 38 |
+
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 40 |
+
pipeline = transformers.pipeline(
|
| 41 |
+
"text-generation",
|
| 42 |
+
model=model,
|
| 43 |
+
model_kwargs={
|
| 44 |
+
"torch_dtype": torch.float16,
|
| 45 |
+
"low_cpu_mem_usage": True,
|
| 46 |
+
"use_cache" : False,
|
| 47 |
+
"gradient_checkpointing" : True,
|
| 48 |
+
"device_map" : 'auto',
|
| 49 |
+
"load_in_8bit" : True
|
| 50 |
+
},
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
messages = [{"role": "user", "content": "Explain what a Mixture of Experts is in less than 100 words."}]
|
| 54 |
+
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 55 |
+
outputs = pipeline(prompt, max_new_tokens=512, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 56 |
+
print(outputs[0]["generated_text"])
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
## 🧩 Configuration
|
| 60 |
|
| 61 |
```yaml
|
|
|
|
| 130 |
- "litigation"
|
| 131 |
- "arbitration"
|
| 132 |
- "mediation"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
```
|