Spaces:
Running
Running
Commit
·
c542faf
1
Parent(s):
f7de47c
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,12 @@ def build_question_selector_map(questions):
|
|
25 |
|
26 |
return question_selector_map
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
def warmup(model_list=model_list, model_inference_endpoints=inference_endpoint):
|
29 |
for i in range(len(model_list)):
|
30 |
API_URL = model_inference_endpoints[model_list[i]["API_URL"]]
|
@@ -86,7 +92,7 @@ def load_responses():
|
|
86 |
# with open("result/MMLU/mmlu_result_cot.json", "r") as mmlu_cot_file:
|
87 |
# mmlu_cot_responses = json.load(mmlu_cot_file)
|
88 |
|
89 |
-
return math_responses, gsm_responses#, mmlu_responses
|
90 |
|
91 |
def load_questions(math, gsm):
|
92 |
math_questions = []
|
@@ -99,11 +105,12 @@ def load_questions(math, gsm):
|
|
99 |
|
100 |
return math_questions, gsm_questions#, mmlu_questions
|
101 |
|
102 |
-
math_result, gsm_result = load_responses()
|
103 |
|
104 |
math_questions, gsm_questions = load_questions(math_result, gsm_result)
|
105 |
|
106 |
math_question_selector_map = build_question_selector_map(math_result)
|
|
|
107 |
gsm_question_selector_map = build_question_selector_map(gsm_result)
|
108 |
|
109 |
TITLE = """<h1 align="center">LLM Agora 🗣️🏦</h1>"""
|
@@ -209,7 +216,7 @@ with gr.Blocks() as demo:
|
|
209 |
|
210 |
with gr.Tab("Math"):
|
211 |
math_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
212 |
-
math_question_list = gr.Dropdown(math_questions, value=callable(math_questions), label="Math Question", every=0.1
|
213 |
|
214 |
with gr.Column():
|
215 |
with gr.Row(elem_id="model1_response"):
|
@@ -230,10 +237,21 @@ with gr.Blocks() as demo:
|
|
230 |
gr.HTML("""<h1 align="center"> The result of Math </h1>""")
|
231 |
# gr.Image(value="result/Math/math_result.png")
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
with gr.Tab("GSM8K"):
|
235 |
gsm_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
236 |
-
gsm_question_list = gr.Dropdown(gsm_questions, label="
|
237 |
|
238 |
with gr.Column():
|
239 |
with gr.Row(elem_id="model1_response"):
|
@@ -257,7 +275,7 @@ with gr.Blocks() as demo:
|
|
257 |
|
258 |
with gr.Tab("MMLU"):
|
259 |
mmlu_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
260 |
-
# mmlu_question_list = gr.Dropdown(mmlu_questions, label="
|
261 |
with gr.Column():
|
262 |
with gr.Row(elem_id="model1_response"):
|
263 |
mmlu_model1_output1 = gr.Textbox(label="Llama2🦙's 1️⃣st response")
|
|
|
25 |
|
26 |
return question_selector_map
|
27 |
|
28 |
+
def display_question_answer(question, cot, request: gr.Request):
|
29 |
+
q = question_selector_map[question]
|
30 |
+
|
31 |
+
return q["agent_response"]["llama"][0], q["agent_response"]["wizardlm"][0], q["agent_response"]["orca"][0], q["agent_response"]["llama"][1], q["agent_response"]["wizardlm"][1], q["agent_response"]["orca"][1], q["agent_response"]["llama"][2], q["agent_response"]["wizardlm"][2], q["agent_response"]["orca"][2]
|
32 |
+
|
33 |
+
|
34 |
def warmup(model_list=model_list, model_inference_endpoints=inference_endpoint):
|
35 |
for i in range(len(model_list)):
|
36 |
API_URL = model_inference_endpoints[model_list[i]["API_URL"]]
|
|
|
92 |
# with open("result/MMLU/mmlu_result_cot.json", "r") as mmlu_cot_file:
|
93 |
# mmlu_cot_responses = json.load(mmlu_cot_file)
|
94 |
|
95 |
+
return math_responses, math_cot_responses, gsm_responses, gsm_cot_responses#, mmlu_responses
|
96 |
|
97 |
def load_questions(math, gsm):
|
98 |
math_questions = []
|
|
|
105 |
|
106 |
return math_questions, gsm_questions#, mmlu_questions
|
107 |
|
108 |
+
math_result, math_cot_result, gsm_result, gsm_cot_result = load_responses()
|
109 |
|
110 |
math_questions, gsm_questions = load_questions(math_result, gsm_result)
|
111 |
|
112 |
math_question_selector_map = build_question_selector_map(math_result)
|
113 |
+
cot_math_question_selector_map = build_question_selector_map(cot_math_result)
|
114 |
gsm_question_selector_map = build_question_selector_map(gsm_result)
|
115 |
|
116 |
TITLE = """<h1 align="center">LLM Agora 🗣️🏦</h1>"""
|
|
|
216 |
|
217 |
with gr.Tab("Math"):
|
218 |
math_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
219 |
+
math_question_list = gr.Dropdown(math_questions, value=callable(math_questions), label="Math Question", every=0.1)
|
220 |
|
221 |
with gr.Column():
|
222 |
with gr.Row(elem_id="model1_response"):
|
|
|
237 |
gr.HTML("""<h1 align="center"> The result of Math </h1>""")
|
238 |
# gr.Image(value="result/Math/math_result.png")
|
239 |
|
240 |
+
math_cot.change(
|
241 |
+
display_question_answer,
|
242 |
+
[math_cot, math_question_list],
|
243 |
+
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
244 |
+
)
|
245 |
+
math_question_list.change(
|
246 |
+
display_question_answer,
|
247 |
+
[math_cot, math_question_list],
|
248 |
+
[math_model1_output1, math_model2_output1, math_model3_output1, math_model1_output2, math_model2_output2, math_model3_output2, math_model1_output3, math_model2_output3, math_model3_output3]
|
249 |
+
)
|
250 |
+
|
251 |
|
252 |
with gr.Tab("GSM8K"):
|
253 |
gsm_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
254 |
+
gsm_question_list = gr.Dropdown(gsm_questions, value=callable(gsm_questions), label="GSM8K Question", every=0.1)
|
255 |
|
256 |
with gr.Column():
|
257 |
with gr.Row(elem_id="model1_response"):
|
|
|
275 |
|
276 |
with gr.Tab("MMLU"):
|
277 |
mmlu_cot = gr.Checkbox(label="CoT", info="If you want to see CoT result, please check the box.")
|
278 |
+
# mmlu_question_list = gr.Dropdown(mmlu_questions, value=callable(mmlu_questions), label="MMLU Question", every=0.1)
|
279 |
with gr.Column():
|
280 |
with gr.Row(elem_id="model1_response"):
|
281 |
mmlu_model1_output1 = gr.Textbox(label="Llama2🦙's 1️⃣st response")
|