GianlucaMondillo
commited on
Commit
•
e65761a
1
Parent(s):
e6c0925
Upload folder using huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- HuggingFaceH4/zephyr-7b-beta
|
4 |
+
- BioMistral/BioMistral-7B
|
5 |
+
tags:
|
6 |
+
- merge
|
7 |
+
- mergekit
|
8 |
+
- lazymergekit
|
9 |
+
- HuggingFaceH4/zephyr-7b-beta
|
10 |
+
- BioMistral/BioMistral-7B
|
11 |
+
---
|
12 |
+
|
13 |
+
# BioZephyr-7B-slerp
|
14 |
+
|
15 |
+
BioZephyr-7B-slerp is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
16 |
+
* [HuggingFaceH4/zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta)
|
17 |
+
* [BioMistral/BioMistral-7B](https://huggingface.co/BioMistral/BioMistral-7B)
|
18 |
+
|
19 |
+
## 🧩 Configuration
|
20 |
+
|
21 |
+
```yaml
|
22 |
+
slices:
|
23 |
+
- sources:
|
24 |
+
- model: HuggingFaceH4/zephyr-7b-beta
|
25 |
+
layer_range: [0, 32]
|
26 |
+
- model: BioMistral/BioMistral-7B
|
27 |
+
layer_range: [0, 32]
|
28 |
+
merge_method: slerp
|
29 |
+
base_model: HuggingFaceH4/zephyr-7b-beta
|
30 |
+
parameters:
|
31 |
+
t:
|
32 |
+
- filter: self_attn
|
33 |
+
value: [0, 0.5, 0.3, 0.7, 1]
|
34 |
+
- filter: mlp
|
35 |
+
value: [1, 0.5, 0.7, 0.3, 0]
|
36 |
+
- value: 0.5
|
37 |
+
dtype: bfloat16
|
38 |
+
```
|
39 |
+
|
40 |
+
## 💻 Usage
|
41 |
+
|
42 |
+
```python
|
43 |
+
!pip install -qU transformers accelerate
|
44 |
+
|
45 |
+
from transformers import AutoTokenizer
|
46 |
+
import transformers
|
47 |
+
import torch
|
48 |
+
|
49 |
+
model = "GianlucaMondillo/BioZephyr-7B-slerp"
|
50 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
51 |
+
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
53 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
54 |
+
pipeline = transformers.pipeline(
|
55 |
+
"text-generation",
|
56 |
+
model=model,
|
57 |
+
torch_dtype=torch.float16,
|
58 |
+
device_map="auto",
|
59 |
+
)
|
60 |
+
|
61 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
62 |
+
print(outputs[0]["generated_text"])
|
63 |
+
```
|