Spaces:
Runtime error
Runtime error
Update stable_cascade.py
Browse files- stable_cascade.py +11 -2
stable_cascade.py
CHANGED
|
@@ -4,8 +4,17 @@ import gradio as gr
|
|
| 4 |
|
| 5 |
|
| 6 |
# Initialize the prior and decoder pipelines
|
| 7 |
-
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16)
|
| 8 |
-
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def generate_images(
|
| 11 |
prompt="a photo of a girl",
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
# Initialize the prior and decoder pipelines
|
| 7 |
+
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16)
|
| 8 |
+
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.bfloat16)
|
| 9 |
+
|
| 10 |
+
prior_pipeline.enable_model_cpu_offload()
|
| 11 |
+
decoder_pipeline.enable_model_cpu_offload()
|
| 12 |
+
|
| 13 |
+
prior_pipeline.prior = torch.compile(prior_pipeline.prior, mode="reduce-overhead", fullgraph=True)
|
| 14 |
+
decoder_pipeline.decoder = torch.compile(decoder_pipeline.decoder, mode="max-autotune", fullgraph=True)
|
| 15 |
+
|
| 16 |
+
prior_pipeline.to("cuda")
|
| 17 |
+
decoder_pipeline.to("cuda")
|
| 18 |
|
| 19 |
def generate_images(
|
| 20 |
prompt="a photo of a girl",
|