Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,6 +48,7 @@ def build_simple_prompt(user_input):
|
|
| 48 |
)
|
| 49 |
|
| 50 |
# Генерация ответов по двум промптам
|
|
|
|
| 51 |
def generate_dual_answers(user_input):
|
| 52 |
results = {}
|
| 53 |
prompt_cot = build_cot_prompt(user_input)
|
|
@@ -56,13 +57,13 @@ def generate_dual_answers(user_input):
|
|
| 56 |
for name, pipe in models.items():
|
| 57 |
# CoT
|
| 58 |
start_cot = time.time()
|
| 59 |
-
out_cot = pipe(prompt_cot,
|
| 60 |
end_cot = round(time.time() - start_cot, 2)
|
| 61 |
answer_cot = out_cot.strip().split('\n')[-1]
|
| 62 |
|
| 63 |
# Simple
|
| 64 |
start_simple = time.time()
|
| 65 |
-
out_simple = pipe(prompt_simple,
|
| 66 |
end_simple = round(time.time() - start_simple, 2)
|
| 67 |
answer_simple = out_simple.strip().split('\n')[-1]
|
| 68 |
|
|
@@ -113,4 +114,4 @@ with gr.Blocks() as demo:
|
|
| 113 |
cot3, cot3_time, simple3, simple3_time
|
| 114 |
])
|
| 115 |
|
| 116 |
-
demo.launch()
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
# Генерация ответов по двум промптам
|
| 51 |
+
|
| 52 |
def generate_dual_answers(user_input):
|
| 53 |
results = {}
|
| 54 |
prompt_cot = build_cot_prompt(user_input)
|
|
|
|
| 57 |
for name, pipe in models.items():
|
| 58 |
# CoT
|
| 59 |
start_cot = time.time()
|
| 60 |
+
out_cot = pipe(prompt_cot, max_new_tokens=100, do_sample=True, top_p=0.9, temperature=0.7)[0]["generated_text"]
|
| 61 |
end_cot = round(time.time() - start_cot, 2)
|
| 62 |
answer_cot = out_cot.strip().split('\n')[-1]
|
| 63 |
|
| 64 |
# Simple
|
| 65 |
start_simple = time.time()
|
| 66 |
+
out_simple = pipe(prompt_simple, max_new_tokens=100, do_sample=True, top_p=0.9, temperature=0.7)[0]["generated_text"]
|
| 67 |
end_simple = round(time.time() - start_simple, 2)
|
| 68 |
answer_simple = out_simple.strip().split('\n')[-1]
|
| 69 |
|
|
|
|
| 114 |
cot3, cot3_time, simple3, simple3_time
|
| 115 |
])
|
| 116 |
|
| 117 |
+
demo.launch()
|