Spaces:
Running
Running
Remove n-best list
Browse files
app.py
CHANGED
@@ -435,19 +435,8 @@ def get_beam_search_html(
|
|
435 |
output_scores=True,
|
436 |
do_sample=False,
|
437 |
)
|
438 |
-
markdown = "The conclusive sequences are the ones that end in an `<|endoftext|>` token or at the end of generation."
|
439 |
-
markdown += "\n\nThey are ranked by their scores, as given by the formula `score = cumulative_score / (output_length ** length_penalty)`.\n\n"
|
440 |
-
markdown += "Only the top `num_beams` scoring sequences are returned: in the tree they are highlighted in **<span style='color:var(--secondary-500)!important'>blue</span>**."
|
441 |
-
markdown += " The non-selected sequences are also shown in the tree, highlighted in **<span style='color:var(--primary-500)!important'>yellow</span>**."
|
442 |
-
markdown += "\n#### <span style='color:var(--secondary-500)!important'>Output sequences:</span>"
|
443 |
-
# Sequences are padded anyway so you can batch decode them
|
444 |
decoded_sequences = tokenizer.batch_decode(outputs.sequences)
|
445 |
-
|
446 |
-
if number_beams > 1:
|
447 |
-
for i, sequence in enumerate(decoded_sequences):
|
448 |
-
markdown += f"\n- Score `{outputs.sequences_scores[i]:.2f}`: `{clean(sequence.replace('<s> ', ''))}`"
|
449 |
-
else:
|
450 |
-
markdown += f"\n- `{clean(decoded_sequences[0].replace('<s> ', ''))}`"
|
451 |
|
452 |
if number_beams > 1:
|
453 |
original_tree = generate_beams(
|
|
|
435 |
output_scores=True,
|
436 |
do_sample=False,
|
437 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
decoded_sequences = tokenizer.batch_decode(outputs.sequences)
|
439 |
+
markdown = ""
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
if number_beams > 1:
|
442 |
original_tree = generate_beams(
|