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