Update app.py
Browse files
app.py
CHANGED
@@ -72,12 +72,11 @@ def generate(
|
|
72 |
{"input_ids": input_ids},
|
73 |
streamer=streamer,
|
74 |
max_new_tokens=max_new_tokens,
|
75 |
-
do_sample=True,
|
76 |
top_p=top_p,
|
77 |
top_k=top_k,
|
78 |
temperature=temperature,
|
79 |
num_beams=1,
|
80 |
-
repetition_penalty=0.0,
|
81 |
)
|
82 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
83 |
t.start()
|
@@ -108,14 +107,14 @@ chat_interface = gr.ChatInterface(
|
|
108 |
minimum=0.1,
|
109 |
maximum=4.0,
|
110 |
step=0.1,
|
111 |
-
value=0
|
112 |
),
|
113 |
gr.Slider(
|
114 |
label="Top-p (nucleus sampling)",
|
115 |
minimum=0.05,
|
116 |
maximum=1.0,
|
117 |
step=0.05,
|
118 |
-
value=0
|
119 |
),
|
120 |
gr.Slider(
|
121 |
label="Top-k",
|
|
|
72 |
{"input_ids": input_ids},
|
73 |
streamer=streamer,
|
74 |
max_new_tokens=max_new_tokens,
|
75 |
+
do_sample=False if (temperature == 0 or top_k == 1) else True,
|
76 |
top_p=top_p,
|
77 |
top_k=top_k,
|
78 |
temperature=temperature,
|
79 |
num_beams=1,
|
|
|
80 |
)
|
81 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
82 |
t.start()
|
|
|
107 |
minimum=0.1,
|
108 |
maximum=4.0,
|
109 |
step=0.1,
|
110 |
+
value=1.0,
|
111 |
),
|
112 |
gr.Slider(
|
113 |
label="Top-p (nucleus sampling)",
|
114 |
minimum=0.05,
|
115 |
maximum=1.0,
|
116 |
step=0.05,
|
117 |
+
value=1.0,
|
118 |
),
|
119 |
gr.Slider(
|
120 |
label="Top-k",
|