Spaces:
Runtime error
Runtime error
<ADD> optimize code
Browse files
app.py
CHANGED
|
@@ -22,7 +22,12 @@ DISPLAY_MAPPING = {
|
|
| 22 |
def do_infer_probs(model, exemplar_attn_kv, exemplar_attn_mask, batched_choices_input):
|
| 23 |
batched_choices_logprobs = []
|
| 24 |
for batched_one_choice_input in batched_choices_input:
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
bs = len(batch_input_ids)
|
| 27 |
|
| 28 |
merged_attn_mask = torch.cat((exemplar_attn_mask.expand(bs, -1), batch_attention_mask), dim=1)
|
|
@@ -178,7 +183,7 @@ Directly employing ICL results in lower prediction accuracy. However, in our pro
|
|
| 178 |
"""
|
| 179 |
<h2 style='text-align: center; margin-bottom: 1rem'>
|
| 180 |
<a href='https://arxiv.org/abs/2305.13016' target="_blank" style='text-decoration: none'>[Paper]</a>
|
| 181 |
-
<a href='https://arxiv.org/abs/2305.13016' target="_blank" style='text-decoration: none'>[Code]</a>
|
| 182 |
</h2>"""
|
| 183 |
)
|
| 184 |
|
|
@@ -205,7 +210,7 @@ Directly employing ICL results in lower prediction accuracy. However, in our pro
|
|
| 205 |
|
| 206 |
prompt = gr.Textbox(label="Demonstrations (Prompt template formatted)", value=demos)
|
| 207 |
gr.Markdown("<h2 style='text-align: center; margin-bottom: 1rem'>👇 Run forward tuning once !</h2>")
|
| 208 |
-
step_button = gr.Button("Click here to train LLM ! Now Step: 1")
|
| 209 |
big_table = gr.DataFrame(
|
| 210 |
value=init_table_result,
|
| 211 |
elem_id="the-table",
|
|
|
|
| 22 |
def do_infer_probs(model, exemplar_attn_kv, exemplar_attn_mask, batched_choices_input):
|
| 23 |
batched_choices_logprobs = []
|
| 24 |
for batched_one_choice_input in batched_choices_input:
|
| 25 |
+
(
|
| 26 |
+
batch_input_ids,
|
| 27 |
+
batch_attention_mask,
|
| 28 |
+
batch_choice_start,
|
| 29 |
+
batch_choice_end,
|
| 30 |
+
) = batched_one_choice_input
|
| 31 |
bs = len(batch_input_ids)
|
| 32 |
|
| 33 |
merged_attn_mask = torch.cat((exemplar_attn_mask.expand(bs, -1), batch_attention_mask), dim=1)
|
|
|
|
| 183 |
"""
|
| 184 |
<h2 style='text-align: center; margin-bottom: 1rem'>
|
| 185 |
<a href='https://arxiv.org/abs/2305.13016' target="_blank" style='text-decoration: none'>[Paper]</a>
|
| 186 |
+
<a href='https://arxiv.org/abs/2305.13016' target="_blank" style='text-decoration: none'>[Code]</a>
|
| 187 |
</h2>"""
|
| 188 |
)
|
| 189 |
|
|
|
|
| 210 |
|
| 211 |
prompt = gr.Textbox(label="Demonstrations (Prompt template formatted)", value=demos)
|
| 212 |
gr.Markdown("<h2 style='text-align: center; margin-bottom: 1rem'>👇 Run forward tuning once !</h2>")
|
| 213 |
+
step_button = gr.Button("Click here to train LLM ! Now Step: 1", variant="primary")
|
| 214 |
big_table = gr.DataFrame(
|
| 215 |
value=init_table_result,
|
| 216 |
elem_id="the-table",
|