Amitontheweb commited on
Commit
9d0b610
1 Parent(s): 84b82d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -417,7 +417,7 @@ with gr.Blocks() as demo:
417
  A space to tweak, test and learn generative model parameters for text output.
418
 
419
  ## Strategies:
420
- --------------
421
  Given some text as input, a decoder-only model hunts for the most popular continuation - whether the continuation makes sense or not - using various search strategies.
422
 
423
  Example:
@@ -431,12 +431,14 @@ with gr.Blocks() as demo:
431
  Option 3: ! [probability score: 0.73]
432
 
433
 
434
- ### **Greedy Search**: Goes along the most well trodden path. Always picks up the next word/token carrying the highest probability score. Default for GPT2.
 
435
 
436
  In this illustrative example, since "!" has the highest probability, a greedy strategy will output: Today is a rainy day!
437
 
438
 
439
- ### **Random Sampling**: Picks up any random path or trail to walk on. Use ```do_sample=True```
 
440
 
441
  *Temperature* - Increasing the temperature allows words with lesser probabilities to show up in the output. At Temp = 0, search becomes 'greedy' for words with high probabilities.
442
 
@@ -447,27 +449,29 @@ with gr.Blocks() as demo:
447
  When used with temperature: Reducing temperature makes the search greedy.
448
 
449
 
450
- ### **Simple Beam search**: Selects the branches (beams) going towards other heavy laden branch of fruits, to find the heaviest set among the branches in all. Akin to greedy search, but finds the total heaviest or largest route.
 
451
 
452
  If num_beams = 2, every branch will divide into the top two scoring tokens at each step, and so on till the search ends.
453
 
454
  *Early Stopping*: Makes the search stop when a pre-determined criteria for ending the search is satisfied.
455
 
456
 
457
- ### **Diversity Beam search**: Divided beams into groups of beams, and applies the diversity penalty. This makes the output more diverse and interesting.
 
458
 
459
  *Group Diversity Penalty*: Used to instruct the next beam group to ignore the words/tokens already selected by previous groups.
460
 
461
 
462
- ### **Contrastive search**: Uses the entire input context to create more interesting outputs.
 
463
 
464
  *Penalty Alpha*: When α=0, search becomes greedy.
465
 
466
  Refer: https://huggingface.co/blog/introducing-csearch
467
 
468
 
469
- ### **Other parameters**:
470
- ---------------------
471
 
472
  - Length penalty: Used to force the model to meet the expected output length.
473
 
@@ -477,7 +481,6 @@ with gr.Blocks() as demo:
477
 
478
 
479
  **References**:
480
- ------------
481
 
482
  1. https://huggingface.co/blog/how-to-generate
483
 
 
417
  A space to tweak, test and learn generative model parameters for text output.
418
 
419
  ## Strategies:
420
+
421
  Given some text as input, a decoder-only model hunts for the most popular continuation - whether the continuation makes sense or not - using various search strategies.
422
 
423
  Example:
 
431
  Option 3: ! [probability score: 0.73]
432
 
433
 
434
+ ### **Greedy Search**:
435
+ Goes along the most well trodden path. Always picks up the next word/token carrying the highest probability score. Default for GPT2.
436
 
437
  In this illustrative example, since "!" has the highest probability, a greedy strategy will output: Today is a rainy day!
438
 
439
 
440
+ ### **Random Sampling**:
441
+ Picks up any random path or trail to walk on. Use ```do_sample=True```
442
 
443
  *Temperature* - Increasing the temperature allows words with lesser probabilities to show up in the output. At Temp = 0, search becomes 'greedy' for words with high probabilities.
444
 
 
449
  When used with temperature: Reducing temperature makes the search greedy.
450
 
451
 
452
+ ### **Simple Beam search**:
453
+ Selects the branches (beams) going towards other heavy laden branch of fruits, to find the heaviest set among the branches in all. Akin to greedy search, but finds the total heaviest or largest route.
454
 
455
  If num_beams = 2, every branch will divide into the top two scoring tokens at each step, and so on till the search ends.
456
 
457
  *Early Stopping*: Makes the search stop when a pre-determined criteria for ending the search is satisfied.
458
 
459
 
460
+ ### **Diversity Beam search**:
461
+ Divided beams into groups of beams, and applies the diversity penalty. This makes the output more diverse and interesting.
462
 
463
  *Group Diversity Penalty*: Used to instruct the next beam group to ignore the words/tokens already selected by previous groups.
464
 
465
 
466
+ ### **Contrastive search**:
467
+ Uses the entire input context to create more interesting outputs.
468
 
469
  *Penalty Alpha*: When α=0, search becomes greedy.
470
 
471
  Refer: https://huggingface.co/blog/introducing-csearch
472
 
473
 
474
+ ### **Other parameters**
 
475
 
476
  - Length penalty: Used to force the model to meet the expected output length.
477
 
 
481
 
482
 
483
  **References**:
 
484
 
485
  1. https://huggingface.co/blog/how-to-generate
486