Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,7 @@ def generate(
|
|
25 |
temperature: float = 0.7,
|
26 |
top_p: float = 1.0,
|
27 |
repetition_penalty: float = 1.1,
|
|
|
28 |
) -> Iterator[str]:
|
29 |
conversation = []
|
30 |
if system_prompt:
|
@@ -49,6 +50,7 @@ def generate(
|
|
49 |
temperature=temperature,
|
50 |
num_beams=1,
|
51 |
repetition_penalty=repetition_penalty,
|
|
|
52 |
)
|
53 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
54 |
t.start()
|
@@ -61,7 +63,7 @@ def generate(
|
|
61 |
chat_interface = gr.ChatInterface(
|
62 |
fn=generate,
|
63 |
additional_inputs=[
|
64 |
-
gr.Textbox(label="System prompt", lines=
|
65 |
gr.Slider(
|
66 |
label="Max new tokens",
|
67 |
minimum=1,
|
@@ -91,7 +93,7 @@ chat_interface = gr.ChatInterface(
|
|
91 |
value=1.1,
|
92 |
),
|
93 |
],
|
94 |
-
|
95 |
examples=[
|
96 |
["Hello there! How are you doing?"],
|
97 |
["Can you explain briefly to me what is the Python programming language?"],
|
@@ -105,4 +107,4 @@ with gr.Blocks(css="style.css") as demo:
|
|
105 |
chat_interface.render()
|
106 |
|
107 |
if __name__ == "__main__":
|
108 |
-
demo.queue(max_size=20).launch()
|
|
|
25 |
temperature: float = 0.7,
|
26 |
top_p: float = 1.0,
|
27 |
repetition_penalty: float = 1.1,
|
28 |
+
stop_ids: list[list[int]] = [[2, 6, 7, 8]]
|
29 |
) -> Iterator[str]:
|
30 |
conversation = []
|
31 |
if system_prompt:
|
|
|
50 |
temperature=temperature,
|
51 |
num_beams=1,
|
52 |
repetition_penalty=repetition_penalty,
|
53 |
+
stop_ids=stop_ids
|
54 |
)
|
55 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
56 |
t.start()
|
|
|
63 |
chat_interface = gr.ChatInterface(
|
64 |
fn=generate,
|
65 |
additional_inputs=[
|
66 |
+
gr.Textbox(label="System prompt", lines=8), # Increase lines for larger box
|
67 |
gr.Slider(
|
68 |
label="Max new tokens",
|
69 |
minimum=1,
|
|
|
93 |
value=1.1,
|
94 |
),
|
95 |
],
|
96 |
+
stop_token=None, # Remove stop token
|
97 |
examples=[
|
98 |
["Hello there! How are you doing?"],
|
99 |
["Can you explain briefly to me what is the Python programming language?"],
|
|
|
107 |
chat_interface.render()
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
+
demo.queue(max_size=20).launch()
|