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