Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ def format_prompt(message, history):
|
|
16 |
return prompt
|
17 |
|
18 |
def generate(
|
19 |
-
prompt, history, system_prompt, max_new_tokens=100, temperature=0.7, repetition_penalty=1.2, top_p=0.95,
|
20 |
):
|
21 |
temperature = float(temperature)
|
22 |
if temperature < 1e-2:
|
@@ -27,10 +27,9 @@ def generate(
|
|
27 |
temperature=temperature,
|
28 |
max_new_tokens=max_new_tokens,
|
29 |
top_p=top_p,
|
30 |
-
top_k=top_k,
|
31 |
repetition_penalty=repetition_penalty,
|
32 |
do_sample=True,
|
33 |
-
seed=
|
34 |
)
|
35 |
|
36 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
@@ -51,7 +50,7 @@ additional_inputs=[
|
|
51 |
gr.Slider(
|
52 |
label="Max new tokens",
|
53 |
value=1000,
|
54 |
-
minimum=
|
55 |
maximum=32768,
|
56 |
step=64,
|
57 |
interactive=True,
|
@@ -84,21 +83,6 @@ additional_inputs=[
|
|
84 |
interactive=True,
|
85 |
info="Higher values sample more low-probability tokens",
|
86 |
),
|
87 |
-
gr.Slider(
|
88 |
-
label="Top-k",
|
89 |
-
value=1,
|
90 |
-
minimum=0,
|
91 |
-
maximum=100,
|
92 |
-
step=1,
|
93 |
-
interactive=True,
|
94 |
-
info="Higher k means more diverse outputs by considering a range of tokens",
|
95 |
-
),
|
96 |
-
gr.Number(
|
97 |
-
label="Manual Seed",
|
98 |
-
value=42,
|
99 |
-
minimum=1,
|
100 |
-
info="Use a manual starting point to initiate the generation process",
|
101 |
-
),
|
102 |
]
|
103 |
|
104 |
examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, None],
|
|
|
16 |
return prompt
|
17 |
|
18 |
def generate(
|
19 |
+
prompt, history, system_prompt, max_new_tokens=100, temperature=0.7, repetition_penalty=1.2, top_p=0.95, seed=42,
|
20 |
):
|
21 |
temperature = float(temperature)
|
22 |
if temperature < 1e-2:
|
|
|
27 |
temperature=temperature,
|
28 |
max_new_tokens=max_new_tokens,
|
29 |
top_p=top_p,
|
|
|
30 |
repetition_penalty=repetition_penalty,
|
31 |
do_sample=True,
|
32 |
+
seed=42,
|
33 |
)
|
34 |
|
35 |
formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
|
|
50 |
gr.Slider(
|
51 |
label="Max new tokens",
|
52 |
value=1000,
|
53 |
+
minimum=100,
|
54 |
maximum=32768,
|
55 |
step=64,
|
56 |
interactive=True,
|
|
|
83 |
interactive=True,
|
84 |
info="Higher values sample more low-probability tokens",
|
85 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
]
|
87 |
|
88 |
examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, None],
|