Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ def respond(
|
|
21 |
max_tokens=512,
|
22 |
temperature=0.5,
|
23 |
top_p=1.0,
|
|
|
24 |
):
|
25 |
messages = [{"role": "system", "content": system_message}]
|
26 |
|
@@ -44,6 +45,7 @@ def respond(
|
|
44 |
max_new_tokens = max_tokens,
|
45 |
temperature = temperature,
|
46 |
top_p = top_p,
|
|
|
47 |
)
|
48 |
generated_ids = [
|
49 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
@@ -59,8 +61,8 @@ demo = gr.ChatInterface(
|
|
59 |
respond,
|
60 |
additional_inputs=[
|
61 |
gr.Textbox(value="You are a helpful AI assistant and your name is RexLM.", label="System message"),
|
62 |
-
gr.Slider(minimum=1, maximum=
|
63 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.
|
64 |
gr.Slider(
|
65 |
minimum=0.1,
|
66 |
maximum=1.0,
|
@@ -68,6 +70,7 @@ demo = gr.ChatInterface(
|
|
68 |
step=0.05,
|
69 |
label="Top-p (nucleus sampling)",
|
70 |
),
|
|
|
71 |
],
|
72 |
)
|
73 |
|
|
|
21 |
max_tokens=512,
|
22 |
temperature=0.5,
|
23 |
top_p=1.0,
|
24 |
+
repetition_penalty=1.1,
|
25 |
):
|
26 |
messages = [{"role": "system", "content": system_message}]
|
27 |
|
|
|
45 |
max_new_tokens = max_tokens,
|
46 |
temperature = temperature,
|
47 |
top_p = top_p,
|
48 |
+
repetition_penalty=repetition_penalty,
|
49 |
)
|
50 |
generated_ids = [
|
51 |
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
|
|
61 |
respond,
|
62 |
additional_inputs=[
|
63 |
gr.Textbox(value="You are a helpful AI assistant and your name is RexLM.", label="System message"),
|
64 |
+
gr.Slider(minimum=1, maximum=4096, value=1024, step=1, label="Max new tokens"),
|
65 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.5, step=0.1, label="Temperature"),
|
66 |
gr.Slider(
|
67 |
minimum=0.1,
|
68 |
maximum=1.0,
|
|
|
70 |
step=0.05,
|
71 |
label="Top-p (nucleus sampling)",
|
72 |
),
|
73 |
+
gr.Slider(minimum=0.5, maximum=1.5, value=1.1, step=0.1, label="Repetation Penalty"),
|
74 |
],
|
75 |
)
|
76 |
|