Spaces:
Running
on
A10G
Running
on
A10G
remove variant
Browse files
app.py
CHANGED
|
@@ -82,12 +82,12 @@ def load_pipeline(
|
|
| 82 |
if "ControlNet" in pipeline_to_benchmark:
|
| 83 |
controlnet_ckpt = pipeline_details[2]
|
| 84 |
controlnet = ControlNetModel.from_pretrained(
|
| 85 |
-
controlnet_ckpt,
|
| 86 |
).to(device)
|
| 87 |
elif "Adapters" in pipeline_to_benchmark:
|
| 88 |
adapter_clpt = pipeline_details[2]
|
| 89 |
adapter = T2IAdapter.from_pretrained(
|
| 90 |
-
adapter_clpt,
|
| 91 |
).to(device)
|
| 92 |
|
| 93 |
# Load pipeline.
|
|
@@ -95,9 +95,7 @@ def load_pipeline(
|
|
| 95 |
"ControlNet" not in pipeline_to_benchmark
|
| 96 |
or "Adapters" not in pipeline_to_benchmark
|
| 97 |
):
|
| 98 |
-
pipeline = pipeline_cls.from_pretrained(
|
| 99 |
-
pipeline_ckpt, variant="fp16", torch_dtype=dtype
|
| 100 |
-
)
|
| 101 |
|
| 102 |
elif "ControlNet" in pipeline_to_benchmark:
|
| 103 |
pipeline = pipeline_cls.from_pretrained(pipeline_ckpt, controlnet=controlnet)
|
|
@@ -205,7 +203,9 @@ def generate(
|
|
| 205 |
print(f"For {num_inference_steps} steps", end_time - start_time)
|
| 206 |
print("Avg per step", (end_time - start_time) / num_inference_steps)
|
| 207 |
|
| 208 |
-
return
|
|
|
|
|
|
|
| 209 |
|
| 210 |
|
| 211 |
with gr.Blocks(css="style.css") as demo:
|
|
|
|
| 82 |
if "ControlNet" in pipeline_to_benchmark:
|
| 83 |
controlnet_ckpt = pipeline_details[2]
|
| 84 |
controlnet = ControlNetModel.from_pretrained(
|
| 85 |
+
controlnet_ckpt, torch_dtype=torch.float16
|
| 86 |
).to(device)
|
| 87 |
elif "Adapters" in pipeline_to_benchmark:
|
| 88 |
adapter_clpt = pipeline_details[2]
|
| 89 |
adapter = T2IAdapter.from_pretrained(
|
| 90 |
+
adapter_clpt, torch_dtype=torch.float16
|
| 91 |
).to(device)
|
| 92 |
|
| 93 |
# Load pipeline.
|
|
|
|
| 95 |
"ControlNet" not in pipeline_to_benchmark
|
| 96 |
or "Adapters" not in pipeline_to_benchmark
|
| 97 |
):
|
| 98 |
+
pipeline = pipeline_cls.from_pretrained(pipeline_ckpt, torch_dtype=dtype)
|
|
|
|
|
|
|
| 99 |
|
| 100 |
elif "ControlNet" in pipeline_to_benchmark:
|
| 101 |
pipeline = pipeline_cls.from_pretrained(pipeline_ckpt, controlnet=controlnet)
|
|
|
|
| 203 |
print(f"For {num_inference_steps} steps", end_time - start_time)
|
| 204 |
print("Avg per step", (end_time - start_time) / num_inference_steps)
|
| 205 |
|
| 206 |
+
return (
|
| 207 |
+
f"Avg per step: {((end_time - start_time) / num_inference_steps):.4f} seconds."
|
| 208 |
+
)
|
| 209 |
|
| 210 |
|
| 211 |
with gr.Blocks(css="style.css") as demo:
|