Spaces:
Sleeping
Sleeping
more updates
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ import utils
|
|
20 |
|
21 |
dtype = torch.float16
|
22 |
device = torch.device("cuda")
|
|
|
23 |
|
24 |
pipeline_mapping = {
|
25 |
"SD T2I": (DiffusionPipeline, "runwayml/stable-diffusion-v1-5"),
|
@@ -202,7 +203,7 @@ def generate(
|
|
202 |
print("Avg per step", (end_time - start_time) / num_inference_steps)
|
203 |
|
204 |
|
205 |
-
with gr.Blocks() as demo:
|
206 |
do_torch_compile = gr.Checkbox(label="Enable torch.compile()?")
|
207 |
use_channels_last = gr.Checkbox(label="Use `channels_last` memory layout?")
|
208 |
pipeline_to_benchmark = gr.Dropdown(
|
@@ -218,6 +219,14 @@ with gr.Blocks() as demo:
|
|
218 |
step=1,
|
219 |
value=1,
|
220 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
btn = gr.Button("Benchmark!").style(
|
222 |
margin=False,
|
223 |
rounded=(False, True, True, False),
|
@@ -227,6 +236,7 @@ with gr.Blocks() as demo:
|
|
227 |
btn.click(
|
228 |
fn=generate,
|
229 |
inputs=[pipeline_to_benchmark, batch_size, use_channels_last, do_torch_compile],
|
|
|
230 |
)
|
231 |
|
232 |
-
demo.launch()
|
|
|
20 |
|
21 |
dtype = torch.float16
|
22 |
device = torch.device("cuda")
|
23 |
+
examples = [[True, True, "SD T2I", 4], [False, True, "Würstchen (T2I)", 4]]
|
24 |
|
25 |
pipeline_mapping = {
|
26 |
"SD T2I": (DiffusionPipeline, "runwayml/stable-diffusion-v1-5"),
|
|
|
203 |
print("Avg per step", (end_time - start_time) / num_inference_steps)
|
204 |
|
205 |
|
206 |
+
with gr.Blocks(css="style.css") as demo:
|
207 |
do_torch_compile = gr.Checkbox(label="Enable torch.compile()?")
|
208 |
use_channels_last = gr.Checkbox(label="Use `channels_last` memory layout?")
|
209 |
pipeline_to_benchmark = gr.Dropdown(
|
|
|
219 |
step=1,
|
220 |
value=1,
|
221 |
)
|
222 |
+
gr.Examples(
|
223 |
+
examples=examples,
|
224 |
+
inputs=[pipeline_to_benchmark, batch_size, use_channels_last, do_torch_compile],
|
225 |
+
outputs="text",
|
226 |
+
fn=generate,
|
227 |
+
cache_examples=True,
|
228 |
+
)
|
229 |
+
|
230 |
btn = gr.Button("Benchmark!").style(
|
231 |
margin=False,
|
232 |
rounded=(False, True, True, False),
|
|
|
236 |
btn.click(
|
237 |
fn=generate,
|
238 |
inputs=[pipeline_to_benchmark, batch_size, use_channels_last, do_torch_compile],
|
239 |
+
outputs="text"
|
240 |
)
|
241 |
|
242 |
+
demo.launch(show_error=True)
|
style.css
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
h1 {
|
2 |
+
text-align: center;
|
3 |
+
}
|
4 |
+
|
5 |
+
#duplicate-button {
|
6 |
+
margin: auto;
|
7 |
+
color: #fff;
|
8 |
+
background: #1565c0;
|
9 |
+
border-radius: 100vh;
|
10 |
+
}
|
11 |
+
|
12 |
+
#component-0 {
|
13 |
+
max-width: 730px;
|
14 |
+
margin: auto;
|
15 |
+
padding-top: 1.5rem;
|
16 |
+
}
|