vpcom commited on
Commit
f85bfb8
1 Parent(s): e01e402

fix: by default none params

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -584,15 +584,14 @@ def generate(
584
  temperature = 1e-2
585
  top_p = float(top_p)
586
  generate_kwargs = dict(
587
- # temperature=temperature,
588
  max_new_tokens=max_new_tokens,
589
- # top_p=top_p,
590
- # repetition_penalty=repetition_penalty,
591
- # top_k=top_k,
 
592
  stop_sequences=stop_sequences,
593
  do_sample=True,
594
  #best_of=2,
595
-
596
  #typical_p=0.9,
597
  #seed=seed,
598
  )
@@ -649,7 +648,7 @@ additional_inputs=[
649
  gr.Slider(
650
  label="Top-p (nucleus sampling)",
651
  value=None,
652
- minimum=0.6,
653
  maximum=1,
654
  step=0.05,
655
  interactive=True,
@@ -657,16 +656,16 @@ additional_inputs=[
657
  ),
658
  gr.Slider(
659
  label="Top-k",
660
- value=None,
661
- minimum=100,
662
  maximum=1000,
663
- step=1,
664
  interactive=True,
665
  info="Higher values sample more low-probability tokens",
666
  ),
667
  gr.Slider(
668
  label="Repetition penalty",
669
- value=None,
670
  minimum=1.0001,
671
  maximum=2.0,
672
  step=0.05,
 
584
  temperature = 1e-2
585
  top_p = float(top_p)
586
  generate_kwargs = dict(
 
587
  max_new_tokens=max_new_tokens,
588
+ temperature=None if temperature==1 else temperature,
589
+ top_p=None if top_p==0 else top_p,
590
+ repetition_penalty=None if repetition_penalty==1 else repetition_penalty,
591
+ top_k=None if top_k==0 else top_k,
592
  stop_sequences=stop_sequences,
593
  do_sample=True,
594
  #best_of=2,
 
595
  #typical_p=0.9,
596
  #seed=seed,
597
  )
 
648
  gr.Slider(
649
  label="Top-p (nucleus sampling)",
650
  value=None,
651
+ minimum=0,
652
  maximum=1,
653
  step=0.05,
654
  interactive=True,
 
656
  ),
657
  gr.Slider(
658
  label="Top-k",
659
+ value=0,
660
+ minimum=0,
661
  maximum=1000,
662
+ step=10,
663
  interactive=True,
664
  info="Higher values sample more low-probability tokens",
665
  ),
666
  gr.Slider(
667
  label="Repetition penalty",
668
+ value=1.0,
669
  minimum=1.0001,
670
  maximum=2.0,
671
  step=0.05,