Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,14 +5,18 @@ from diffusers import DiffusionPipeline
|
|
| 5 |
|
| 6 |
print("Loading pipeline...")
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
pipe = DiffusionPipeline.from_pretrained(
|
| 9 |
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
| 10 |
torch_dtype=torch.bfloat16,
|
| 11 |
)
|
| 12 |
|
| 13 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 14 |
|
| 15 |
-
pipe.to(
|
| 16 |
|
| 17 |
pipe.unet.load_attn_procs(
|
| 18 |
"./pytorch_custom_diffusion_weights.bin"
|
|
|
|
| 5 |
|
| 6 |
print("Loading pipeline...")
|
| 7 |
|
| 8 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 9 |
+
|
| 10 |
+
dtype = torch.float16 if device == "cuda" else torch.float32
|
| 11 |
+
|
| 12 |
pipe = DiffusionPipeline.from_pretrained(
|
| 13 |
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
| 14 |
torch_dtype=torch.bfloat16,
|
| 15 |
)
|
| 16 |
|
| 17 |
+
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
|
| 19 |
+
pipe.to(device)
|
| 20 |
|
| 21 |
pipe.unet.load_attn_procs(
|
| 22 |
"./pytorch_custom_diffusion_weights.bin"
|