fractal-786
commited on
Commit
•
858818a
1
Parent(s):
1bb3274
Upload folder using huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- merge
|
4 |
+
- mergekit
|
5 |
+
- lazymergekit
|
6 |
+
---
|
7 |
+
|
8 |
+
# llama-phi-slErp
|
9 |
+
|
10 |
+
llama-phi-slErp is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
11 |
+
|
12 |
+
## 🧩 Configuration
|
13 |
+
|
14 |
+
```yaml
|
15 |
+
models:
|
16 |
+
- model: microsoft/Phi-3-small-128k-instruct
|
17 |
+
- model: MaziyarPanahi/Llama-3-8B-Instruct-v0.8
|
18 |
+
merge_method: slerp
|
19 |
+
base_model: microsoft/Phi-3-small-128k-instruct
|
20 |
+
dtype: bfloat16
|
21 |
+
parameters:
|
22 |
+
t: [0, 0.5, 1, 0.5, 0]
|
23 |
+
```
|
24 |
+
|
25 |
+
## 💻 Usage
|
26 |
+
|
27 |
+
```python
|
28 |
+
!pip install -qU transformers accelerate
|
29 |
+
|
30 |
+
from transformers import AutoTokenizer
|
31 |
+
import transformers
|
32 |
+
import torch
|
33 |
+
|
34 |
+
model = "fractal-786/llama-phi-slErp"
|
35 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
36 |
+
|
37 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
38 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
39 |
+
pipeline = transformers.pipeline(
|
40 |
+
"text-generation",
|
41 |
+
model=model,
|
42 |
+
torch_dtype=torch.float16,
|
43 |
+
device_map="auto",
|
44 |
+
)
|
45 |
+
|
46 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
47 |
+
print(outputs[0]["generated_text"])
|
48 |
+
```
|