Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,166 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
thumbnail: "https://cdn-uploads.huggingface.co/production/uploads/6589d7e6586088fd2784a12c/Wv1Nqd_2MKbBlaiORb479.png"
|
6 |
+
---
|
7 |
+
# Be one with nature.
|
8 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6589d7e6586088fd2784a12c/Wv1Nqd_2MKbBlaiORb479.png)
|
9 |
+
|
10 |
+
### Named after the method used to create it, interleaving the layers of its predecessor to become far larger, giving it much more potential.
|
11 |
+
|
12 |
+
|
13 |
+
[Goru](https://hearthstone.fandom.com/wiki/Goru_the_Mightree) was an ancient treeant, and I couldn't think of a better naming convention for a model that was created using the passthrough method.
|
14 |
+
|
15 |
+
By concatenating layers from different LLMs, it can produce models with an exotic number of parameters (e.g., 9B with two 7B parameter models). These models are often referred to as "frankenmerges" or "Frankenstein models" by the community.
|
16 |
+
|
17 |
+
|
18 |
+
Many thanks to [Microsoft](https://huggingface.co/microsoft) for providing the [fine tuned weights](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) that were used in the creation of this base model. out this script.
|
19 |
+
|
20 |
+
## This idea was brought to me by [KatyTheCutie](https://huggingface.co/KatyTheCutie). I have her to thank if fine-tuning this model turns out to be a success.
|
21 |
+
# How to run inference:
|
22 |
+
|
23 |
+
```python
|
24 |
+
import transformers
|
25 |
+
import torch
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
model_name = "Replete-AI/Phi-3-Goru"
|
29 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
|
30 |
+
|
31 |
+
model = (
|
32 |
+
transformers.AutoModelForCausalLM.from_pretrained(
|
33 |
+
model_name,
|
34 |
+
)
|
35 |
+
.to("cuda:0")
|
36 |
+
.eval()
|
37 |
+
)
|
38 |
+
|
39 |
+
messages = [
|
40 |
+
{"role": "user", "content": "Hello, who are you?"}
|
41 |
+
]
|
42 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
|
43 |
+
input_ids_cutoff = inputs.size(dim=1)
|
44 |
+
|
45 |
+
with torch.no_grad():
|
46 |
+
generated_ids = model.generate(
|
47 |
+
input_ids=inputs,
|
48 |
+
use_cache=True,
|
49 |
+
max_new_tokens=512,
|
50 |
+
temperature=0.2,
|
51 |
+
top_p=0.95,
|
52 |
+
do_sample=True,
|
53 |
+
eos_token_id=tokenizer.eos_token_id,
|
54 |
+
pad_token_id=tokenizer.pad_token_id,
|
55 |
+
)
|
56 |
+
|
57 |
+
completion = tokenizer.decode(
|
58 |
+
generated_ids[0][input_ids_cutoff:],
|
59 |
+
skip_special_tokens=True,
|
60 |
+
)
|
61 |
+
|
62 |
+
print(completion)
|
63 |
+
```
|
64 |
+
|
65 |
+
# [Join the Replete AI Discord here!](https://discord.gg/tG5aY4EX4T)
|
66 |
+
|
67 |
+
# The Sauce:
|
68 |
+
|
69 |
+
```yml
|
70 |
+
dtype: bfloat16
|
71 |
+
merge_method: passthrough
|
72 |
+
slices:
|
73 |
+
- sources:
|
74 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
75 |
+
layer_range: [0,2]
|
76 |
+
- sources:
|
77 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
78 |
+
layer_range: [1,3]
|
79 |
+
- sources:
|
80 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
81 |
+
layer_range: [2,4]
|
82 |
+
- sources:
|
83 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
84 |
+
layer_range: [3,5]
|
85 |
+
- sources:
|
86 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
87 |
+
layer_range: [4,6]
|
88 |
+
- sources:
|
89 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
90 |
+
layer_range: [5,7]
|
91 |
+
- sources:
|
92 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
93 |
+
layer_range: [6,8]
|
94 |
+
- sources:
|
95 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
96 |
+
layer_range: [7,9]
|
97 |
+
- sources:
|
98 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
99 |
+
layer_range: [8,10]
|
100 |
+
- sources:
|
101 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
102 |
+
layer_range: [9,11]
|
103 |
+
- sources:
|
104 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
105 |
+
layer_range: [10,12]
|
106 |
+
- sources:
|
107 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
108 |
+
layer_range: [11,13]
|
109 |
+
- sources:
|
110 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
111 |
+
layer_range: [12,14]
|
112 |
+
- sources:
|
113 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
114 |
+
layer_range: [13,15]
|
115 |
+
- sources:
|
116 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
117 |
+
layer_range: [14,16]
|
118 |
+
- sources:
|
119 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
120 |
+
layer_range: [15,17]
|
121 |
+
- sources:
|
122 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
123 |
+
layer_range: [16,18]
|
124 |
+
- sources:
|
125 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
126 |
+
layer_range: [17,19]
|
127 |
+
- sources:
|
128 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
129 |
+
layer_range: [18,20]
|
130 |
+
- sources:
|
131 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
132 |
+
layer_range: [19,21]
|
133 |
+
- sources:
|
134 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
135 |
+
layer_range: [20,22]
|
136 |
+
- sources:
|
137 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
138 |
+
layer_range: [21,23]
|
139 |
+
- sources:
|
140 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
141 |
+
layer_range: [22,24]
|
142 |
+
- sources:
|
143 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
144 |
+
layer_range: [23,25]
|
145 |
+
- sources:
|
146 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
147 |
+
layer_range: [24,26]
|
148 |
+
- sources:
|
149 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
150 |
+
layer_range: [25,27]
|
151 |
+
- sources:
|
152 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
153 |
+
layer_range: [26,28]
|
154 |
+
- sources:
|
155 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
156 |
+
layer_range: [27,29]
|
157 |
+
- sources:
|
158 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
159 |
+
layer_range: [28,30]
|
160 |
+
- sources:
|
161 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
162 |
+
layer_range: [29,31]
|
163 |
+
- sources:
|
164 |
+
- model: microsoft/Phi-3-mini-4k-instruct
|
165 |
+
layer_range: [30,32]
|
166 |
+
```
|