Spaces:
Runtime error
Runtime error
Try inline pipeline to reduce memory usage.
Browse files
app.py
CHANGED
|
@@ -62,7 +62,7 @@ class DropOutput(Callback):
|
|
| 62 |
# is_mega=True,
|
| 63 |
# is_reusable=True
|
| 64 |
# )
|
| 65 |
-
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", custom_pipeline="stable_diffusion_mega", torch_dtype=torch.float32, use_auth_token=AUTH_TOKEN)
|
| 66 |
|
| 67 |
# pipeline.to("cuda")
|
| 68 |
|
|
@@ -73,6 +73,9 @@ def gen_image(prompt):
|
|
| 73 |
# Hugging Space faces seems to run out of memory if grads are not disabled
|
| 74 |
# torch.set_grad_enabled(False)
|
| 75 |
print(f'RUNNING gen_image with prompt: {prompt}')
|
|
|
|
|
|
|
|
|
|
| 76 |
images = pipeline.text2img(prompt, width=512, height=512).images
|
| 77 |
# images = model.generate_images(
|
| 78 |
# text=prompt,
|
|
|
|
| 62 |
# is_mega=True,
|
| 63 |
# is_reusable=True
|
| 64 |
# )
|
| 65 |
+
# pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", custom_pipeline="stable_diffusion_mega", torch_dtype=torch.float32, use_auth_token=AUTH_TOKEN)
|
| 66 |
|
| 67 |
# pipeline.to("cuda")
|
| 68 |
|
|
|
|
| 73 |
# Hugging Space faces seems to run out of memory if grads are not disabled
|
| 74 |
# torch.set_grad_enabled(False)
|
| 75 |
print(f'RUNNING gen_image with prompt: {prompt}')
|
| 76 |
+
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",
|
| 77 |
+
custom_pipeline="stable_diffusion_mega", torch_dtype=torch.float32,
|
| 78 |
+
use_auth_token=AUTH_TOKEN)
|
| 79 |
images = pipeline.text2img(prompt, width=512, height=512).images
|
| 80 |
# images = model.generate_images(
|
| 81 |
# text=prompt,
|