Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -467,29 +467,19 @@ with gr.Blocks(
|
|
467 |
gr.Markdown(
|
468 |
"""# <span style='color:var(--primary-500)!important'>Beam Search Visualizer</span>
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
Here's GPT2 doing beam search decoding for you.
|
473 |
-
|
474 |
-
#### <span style='color:var(--primary-500)!important'>Parameters:</span>
|
475 |
-
- **Sentence to decode from** (`inputs`): the input sequence to your decoder.
|
476 |
-
- **Number of steps** (`max_new_tokens`): the number of tokens to generate.
|
477 |
-
- **Number of beams** (`num_beams`): the number of beams to use.
|
478 |
-
- **Length penalty** (`length_penalty`): the length penalty to apply to outputs. `length_penalty` > 0.0 promotes longer sequences, while `length_penalty` < 0.0 encourages shorter sequences.
|
479 |
-
This parameter will not impact the beam search paths, but only influence the choice of sequences in the end towards longer or shorter sequences.
|
480 |
-
- **Number of return sequences** (`num_return_sequences`): the number of sequences to be returned at the end of generation. Should be `<= num_beams`.
|
481 |
"""
|
482 |
)
|
483 |
text = gr.Textbox(
|
484 |
-
label="
|
485 |
-
value="
|
486 |
)
|
487 |
with gr.Row():
|
488 |
n_steps = gr.Slider(
|
489 |
-
label="Number of
|
490 |
)
|
491 |
n_beams = gr.Slider(
|
492 |
-
label="
|
493 |
)
|
494 |
|
495 |
button = gr.Button()
|
|
|
467 |
gr.Markdown(
|
468 |
"""# <span style='color:var(--primary-500)!important'>Beam Search Visualizer</span>
|
469 |
|
470 |
+
Author: Aymeric Roucher
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
"""
|
472 |
)
|
473 |
text = gr.Textbox(
|
474 |
+
label="Prompt",
|
475 |
+
value="Baking a cake is easy. First, you need to",
|
476 |
)
|
477 |
with gr.Row():
|
478 |
n_steps = gr.Slider(
|
479 |
+
label="Number of tokens", minimum=1, maximum=24, step=1, value=12
|
480 |
)
|
481 |
n_beams = gr.Slider(
|
482 |
+
label="Beam size", minimum=1, maximum=4, step=1, value=4
|
483 |
)
|
484 |
|
485 |
button = gr.Button()
|