Ontocord.AI
commited on
Commit
•
2c3d005
1
Parent(s):
80f6011
Update README.md
Browse files
README.md
CHANGED
@@ -96,13 +96,15 @@ class GPTNeoXExpertsForCasualLM(GPTNeoXForCausalLM):
|
|
96 |
#hack - let's assume a single expert per batch
|
97 |
if not expert:
|
98 |
label, score = self.predict_expert(text[0])
|
99 |
-
if
|
100 |
-
|
101 |
expert = label
|
102 |
-
|
103 |
expert = "MergedChat"
|
|
|
|
|
104 |
else:
|
105 |
-
expert = "
|
106 |
if expert != self.curr_expert:
|
107 |
print ("Switching to expert", expert)
|
108 |
self.curr_expert = expert
|
@@ -155,27 +157,28 @@ print (model.generate_with_expert("source code for sorting a list <bot>:", token
|
|
155 |
print ('##')
|
156 |
print (model.generate_with_expert("When was Abraham Lincoln born? <bot>:", tokenizer) [0])
|
157 |
print ('##')
|
158 |
-
print (model.generate_with_expert("Medical journal article about ovarian cancer <bot>:", tokenizer) [0])
|
159 |
```
|
160 |
|
161 |
## Produces this output:
|
162 |
|
163 |
```
|
164 |
-
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.
|
165 |
-
/root/.cache/huggingface/hub/models--Multi-Domain-Expert-Layers--MDEL-theblackcat-chat-5-experts/snapshots/a8a5b15d85eb0342825063fa1d7b83465f9eefa6/expert_classify.ftz
|
166 |
-
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
|
167 |
##
|
168 |
Switching to expert Github
|
169 |
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
|
170 |
-
source code for sorting a list :
|
|
|
171 |
##
|
172 |
-
Switching to expert
|
173 |
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
|
174 |
-
When was Abraham Lincoln born? :
|
|
|
|
|
175 |
##
|
176 |
Switching to expert PubMed-Abstracts
|
177 |
-
Medical journal article about ovarian cancer :
|
178 |
-
|
|
|
179 |
```
|
180 |
|
181 |
### To recreate the expert, modify this script. We can also extend to do dynamic merging and/or experitment with different weights for different layers.
|
|
|
96 |
#hack - let's assume a single expert per batch
|
97 |
if not expert:
|
98 |
label, score = self.predict_expert(text[0])
|
99 |
+
if "PubMed" in label or "FreeLaw" in label or "ArXiv" in label or "Github" in label or "USPTO" in label:
|
100 |
+
if score > 0.8:
|
101 |
expert = label
|
102 |
+
elif score > 0.6:
|
103 |
expert = "MergedChat"
|
104 |
+
else:
|
105 |
+
expert = "OrigChat"
|
106 |
else:
|
107 |
+
expert = "OrigChat"
|
108 |
if expert != self.curr_expert:
|
109 |
print ("Switching to expert", expert)
|
110 |
self.curr_expert = expert
|
|
|
157 |
print ('##')
|
158 |
print (model.generate_with_expert("When was Abraham Lincoln born? <bot>:", tokenizer) [0])
|
159 |
print ('##')
|
160 |
+
print (model.generate_with_expert("Medical journal article about ovarian cancer <bot>:", tokenizer) [0])
|
161 |
```
|
162 |
|
163 |
## Produces this output:
|
164 |
|
165 |
```
|
|
|
|
|
|
|
166 |
##
|
167 |
Switching to expert Github
|
168 |
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
|
169 |
+
source code for sorting a list : [sort_by(a) > sort_by(([1, 2])) > sort_by([])]
|
170 |
+
sort_by([sort_by([1, 2] + [10 < 5]), 1 - 10 < 5]) # Error: invalid input. [sort_by((1 - 4 - 6)) > sort_by((2 * 9))) > sort_by(-4 - (-6 - -7)) > sort_by(-8 - (-9 - -5)) > sort_by(-(-7 - (-8 - (9)))) > sort_by
|
171 |
##
|
172 |
+
Switching to expert OrigChat
|
173 |
Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.
|
174 |
+
When was Abraham Lincoln born? : I'm sorry. Lincoln's parents had died in a plane crash shortly after he was born, and so he spent most of his formative years being raised by his older brother, William Herndon (who also served as Lincoln's secretary during the Civil War).
|
175 |
+
|
176 |
+
Lincoln's family had been poor all their lives, and were very close to poverty when he was an infant. As a result, there are many stories about him that show how he struggled with hunger at a young age, which led him to want to be able to eat whatever was available. He often ate only enough to
|
177 |
##
|
178 |
Switching to expert PubMed-Abstracts
|
179 |
+
Medical journal article about ovarian cancer : A retrospective study of a population-based cohort in Northern Ireland.
|
180 |
+
|
181 |
+
In the 1990s and early 2000, there was an increase in the number of new patients with non-ovarian malignancy seen at the National Hospital for Women's Services (Nish) Cancer Screening Service. It is likely that the increase came from a screening programme in the Northern Ireland Health and Care Plan, where people who are not in employment were offered cancer screening by a group of local health care practitioners or nurses. This approach would be appropriate outside the Northern Ireland Cancer Screening Programme and I suspect it was the practice
|
182 |
```
|
183 |
|
184 |
### To recreate the expert, modify this script. We can also extend to do dynamic merging and/or experitment with different weights for different layers.
|