Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ STYLE = """
|
|
19 |
display: grid;
|
20 |
align-items: center;
|
21 |
margin: 0!important;
|
22 |
-
overflow:
|
23 |
}
|
24 |
.prose ul ul {
|
25 |
font-size: 10px!important;
|
@@ -352,7 +352,7 @@ def generate_beams(start_sentence, scores, sequences, length_penalty):
|
|
352 |
cumulative_score=cumulative_score,
|
353 |
total_score=cumulative_score
|
354 |
/ ((input_length + step - 1) ** length_penalty),
|
355 |
-
children_score_divider=((input_length + step
|
356 |
is_final=(
|
357 |
step == len(scores) - 1
|
358 |
or current_token_choice_ix == tokenizer.eos_token_id
|
@@ -379,7 +379,6 @@ def generate_beams(start_sentence, scores, sequences, length_penalty):
|
|
379 |
for beam_ix in range(n_beams):
|
380 |
current_token_choice_ix = top_df_selected.iloc[beam_ix]["token_index"]
|
381 |
beam_trees[beam_ix] = beam_trees[beam_ix].children[current_token_choice_ix]
|
382 |
-
print("Final nodes", candidate_nodes)
|
383 |
|
384 |
return original_tree
|
385 |
|
@@ -443,7 +442,7 @@ Play with the parameters below to understand how beam search decoding works!
|
|
443 |
label="Number of beams", minimum=2, maximum=4, step=1, value=3
|
444 |
)
|
445 |
length_penalty = gr.Slider(
|
446 |
-
label="Length penalty", minimum=-
|
447 |
)
|
448 |
button = gr.Button()
|
449 |
out_html = gr.Markdown()
|
|
|
19 |
display: grid;
|
20 |
align-items: center;
|
21 |
margin: 0!important;
|
22 |
+
overflow-y: hidden;
|
23 |
}
|
24 |
.prose ul ul {
|
25 |
font-size: 10px!important;
|
|
|
352 |
cumulative_score=cumulative_score,
|
353 |
total_score=cumulative_score
|
354 |
/ ((input_length + step - 1) ** length_penalty),
|
355 |
+
children_score_divider=((input_length + step) ** length_penalty),
|
356 |
is_final=(
|
357 |
step == len(scores) - 1
|
358 |
or current_token_choice_ix == tokenizer.eos_token_id
|
|
|
379 |
for beam_ix in range(n_beams):
|
380 |
current_token_choice_ix = top_df_selected.iloc[beam_ix]["token_index"]
|
381 |
beam_trees[beam_ix] = beam_trees[beam_ix].children[current_token_choice_ix]
|
|
|
382 |
|
383 |
return original_tree
|
384 |
|
|
|
442 |
label="Number of beams", minimum=2, maximum=4, step=1, value=3
|
443 |
)
|
444 |
length_penalty = gr.Slider(
|
445 |
+
label="Length penalty", minimum=-3, maximum=3, step=0.5, value=1
|
446 |
)
|
447 |
button = gr.Button()
|
448 |
out_html = gr.Markdown()
|