m-ric HF staff commited on
Commit
179959e
β€’
1 Parent(s): 5abc01d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -150,13 +150,13 @@ STYLE = """
150
  }
151
  /*Hover-Section*/
152
  .tree li a:hover, .tree li a:hover+ul li a {
153
- background: var(--primary-700);
154
  }
155
  .tree li a:hover+ul li::after, .tree li a:hover+ul li::before, .tree li a:hover+ul::before, .tree li a:hover+ul ul::before, .tree li a:hover+ul a::before {
156
- border-color: var(--primary-200);
157
  }
158
  .end-of-text, .chosen-token {
159
- background-color: var(--primary-600);
160
  }
161
  .end-of-text {
162
  width:auto!important;
@@ -166,7 +166,7 @@ STYLE = """
166
  min-width: 280px;
167
  }
168
  .selected-sequence {
169
- background-color: var(--secondary-600)!important;
170
  }
171
  """
172
 
@@ -399,8 +399,8 @@ def get_beam_search_html(input_text, number_steps, number_beams, length_penalty)
399
  )
400
  markdown = "The conclusive sequences are the ones that end in an `<|endoftext|>` token or at the end of generation."
401
  markdown += "\n\nThey are ranked by their scores, as given by the formula `score = cumulative_score / (output_length ** length_penalty)`.\n\n"
402
- markdown += "Only the top `num_beams` scoring sequences are returned: in the tree they are highlighted in **<span style='color:var(--secondary-600)!important'>blue</span>**."
403
- markdown += " The non-selected sequences are also shown in the tree, highlighted in **<span style='color:var(--primary-600)!important'>yellow</span>**."
404
  markdown += "\n#### <span style='color:var(--secondary-600)!important'>Output sequences:</span>"
405
  # Sequences are padded anyway so you can batch decode them
406
  decoded_sequences = tokenizer.batch_decode(outputs.sequences)
@@ -425,11 +425,11 @@ with gr.Blocks(
425
  css=STYLE,
426
  ) as demo:
427
  gr.Markdown(
428
- """# <span style='color:var(--primary-600)!important'>Beam Search Visualizer</span>
429
 
430
  Play with the parameters below to understand how beam search decoding works!
431
 
432
- #### <span style='color:var(--primary-600)!important'>Parameters:</span>
433
  - **Sentence to decode from** (`inputs`): the input sequence to your decoder.
434
  - **Number of steps** (`max_new_tokens`): the number of tokens to generate
435
  - **Number of beams** (`num_beams`): the number of beams to use
 
150
  }
151
  /*Hover-Section*/
152
  .tree li a:hover, .tree li a:hover+ul li a {
153
+ background: var(--primary-600);
154
  }
155
  .tree li a:hover+ul li::after, .tree li a:hover+ul li::before, .tree li a:hover+ul::before, .tree li a:hover+ul ul::before, .tree li a:hover+ul a::before {
156
+ border-color: var(--primary-400);
157
  }
158
  .end-of-text, .chosen-token {
159
+ background-color: var(--primary-500);
160
  }
161
  .end-of-text {
162
  width:auto!important;
 
166
  min-width: 280px;
167
  }
168
  .selected-sequence {
169
+ background-color: var(--secondary-500)!important;
170
  }
171
  """
172
 
 
399
  )
400
  markdown = "The conclusive sequences are the ones that end in an `<|endoftext|>` token or at the end of generation."
401
  markdown += "\n\nThey are ranked by their scores, as given by the formula `score = cumulative_score / (output_length ** length_penalty)`.\n\n"
402
+ 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>**."
403
+ markdown += " The non-selected sequences are also shown in the tree, highlighted in **<span style='color:var(--primary-500)!important'>yellow</span>**."
404
  markdown += "\n#### <span style='color:var(--secondary-600)!important'>Output sequences:</span>"
405
  # Sequences are padded anyway so you can batch decode them
406
  decoded_sequences = tokenizer.batch_decode(outputs.sequences)
 
425
  css=STYLE,
426
  ) as demo:
427
  gr.Markdown(
428
+ """# <span style='color:var(--primary-500)!important'>Beam Search Visualizer</span>
429
 
430
  Play with the parameters below to understand how beam search decoding works!
431
 
432
+ #### <span style='color:var(--primary-500)!important'>Parameters:</span>
433
  - **Sentence to decode from** (`inputs`): the input sequence to your decoder.
434
  - **Number of steps** (`max_new_tokens`): the number of tokens to generate
435
  - **Number of beams** (`num_beams`): the number of beams to use