Locutusque commited on
Commit
a184d8d
·
verified ·
1 Parent(s): 1504bfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -14,6 +14,7 @@ def generate(
14
  user_input,
15
  temperature=0.4,
16
  top_p=0.95,
 
17
  top_k=50,
18
  max_new_tokens=256,
19
  ):
@@ -25,7 +26,7 @@ def generate(
25
  else:
26
  prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
27
  streamer = TextIteratorStreamer(pipe.tokenizer, timeout=240.0, skip_prompt=True, skip_special_tokens=True)
28
- generation_kwargs = dict(text_inputs=prompt, streamer=streamer, max_new_tokens=max_new_tokens, do_sample=True, top_p=top_p, top_k=top_k,
29
  temperature=temperature, num_beams=1, repetition_penalty=1.1)
30
  t = Thread(target=pipe.__call__, kwargs=generation_kwargs)
31
  t.start()
@@ -43,6 +44,7 @@ g = gr.Interface(
43
  gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
44
  gr.components.Slider(minimum=0, maximum=1, value=0.8, label="Temperature"),
45
  gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p"),
 
46
  gr.components.Slider(minimum=0, maximum=100, step=1, value=15, label="Top k"),
47
  gr.components.Slider(minimum=1, maximum=2048, step=1, value=1024, label="Max tokens"),
48
  ],
 
14
  user_input,
15
  temperature=0.4,
16
  top_p=0.95,
17
+ min_p=0.1,
18
  top_k=50,
19
  max_new_tokens=256,
20
  ):
 
26
  else:
27
  prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
28
  streamer = TextIteratorStreamer(pipe.tokenizer, timeout=240.0, skip_prompt=True, skip_special_tokens=True)
29
+ generation_kwargs = dict(text_inputs=prompt, streamer=streamer, max_new_tokens=max_new_tokens, do_sample=True, top_p=top_p, min_p=min_p, top_k=top_k,
30
  temperature=temperature, num_beams=1, repetition_penalty=1.1)
31
  t = Thread(target=pipe.__call__, kwargs=generation_kwargs)
32
  t.start()
 
44
  gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
45
  gr.components.Slider(minimum=0, maximum=1, value=0.8, label="Temperature"),
46
  gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p"),
47
+ gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Min P"),
48
  gr.components.Slider(minimum=0, maximum=100, step=1, value=15, label="Top k"),
49
  gr.components.Slider(minimum=1, maximum=2048, step=1, value=1024, label="Max tokens"),
50
  ],