Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,15 +77,14 @@ if torch.__version__ >= "2":
|
|
77 |
|
78 |
def evaluate(
|
79 |
instruction,
|
80 |
-
|
81 |
temperature=0.1,
|
82 |
top_p=0.75,
|
83 |
top_k=40,
|
84 |
num_beams=4,
|
85 |
max_new_tokens=128,
|
86 |
-
|
87 |
-
|
88 |
-
prompt = generate_prompt(instruction, input)
|
89 |
inputs = tokenizer(prompt, return_tensors="pt")
|
90 |
input_ids = inputs["input_ids"].to(device)
|
91 |
generation_config = GenerationConfig(
|
@@ -110,25 +109,13 @@ def evaluate(
|
|
110 |
|
111 |
g = gr.Interface(
|
112 |
fn=evaluate,
|
113 |
-
inputs=
|
114 |
-
gr.components.Textbox(
|
115 |
lines=2, label="Instruction", placeholder="Tell me about alpacas."
|
116 |
-
|
117 |
-
|
118 |
-
gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Temperature"),
|
119 |
-
gr.components.Slider(minimum=0, maximum=1, value=0.75, label="Top p"),
|
120 |
-
gr.components.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k"),
|
121 |
-
gr.components.Slider(minimum=1, maximum=4, step=1, value=4, label="Beams"),
|
122 |
-
gr.components.Slider(
|
123 |
-
minimum=1, maximum=512, step=1, value=128, label="Max tokens"
|
124 |
-
),
|
125 |
-
],
|
126 |
-
outputs=[
|
127 |
-
gr.inputs.Textbox(
|
128 |
lines=5,
|
129 |
label="Output",
|
130 |
-
|
131 |
-
],
|
132 |
title="bloom 1b1",
|
133 |
description="",
|
134 |
)
|
|
|
77 |
|
78 |
def evaluate(
|
79 |
instruction,
|
80 |
+
):
|
81 |
temperature=0.1,
|
82 |
top_p=0.75,
|
83 |
top_k=40,
|
84 |
num_beams=4,
|
85 |
max_new_tokens=128,
|
86 |
+
|
87 |
+
prompt = instruction
|
|
|
88 |
inputs = tokenizer(prompt, return_tensors="pt")
|
89 |
input_ids = inputs["input_ids"].to(device)
|
90 |
generation_config = GenerationConfig(
|
|
|
109 |
|
110 |
g = gr.Interface(
|
111 |
fn=evaluate,
|
112 |
+
inputs= gr.components.Textbox(
|
|
|
113 |
lines=2, label="Instruction", placeholder="Tell me about alpacas."
|
114 |
+
),
|
115 |
+
outputs= gr.inputs.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
lines=5,
|
117 |
label="Output",
|
118 |
+
),
|
|
|
119 |
title="bloom 1b1",
|
120 |
description="",
|
121 |
)
|