Spaces:
Running
Running
Sean Powell commited on
Commit ·
caa0f8b
1
Parent(s): 5126622
Support device in pipe initialisers.
Browse files- utils/pipes.py +2 -6
utils/pipes.py
CHANGED
|
@@ -4,9 +4,7 @@ from diffusers import StableDiffusionXLImg2ImgPipeline, StableDiffusionXLPipelin
|
|
| 4 |
from utils import tiling
|
| 5 |
|
| 6 |
|
| 7 |
-
def create_stable_diffusion_xl_pipeline():
|
| 8 |
-
device = "mps" if torch.backends.mps.is_available() else "cuda"
|
| 9 |
-
|
| 10 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 11 |
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 12 |
)
|
|
@@ -16,9 +14,7 @@ def create_stable_diffusion_xl_pipeline():
|
|
| 16 |
return pipe
|
| 17 |
|
| 18 |
|
| 19 |
-
def create_stable_diffusion_xl_img2img_pipe():
|
| 20 |
-
device = "mps" if torch.backends.mps.is_available() else "cuda"
|
| 21 |
-
|
| 22 |
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
| 23 |
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 24 |
)
|
|
|
|
| 4 |
from utils import tiling
|
| 5 |
|
| 6 |
|
| 7 |
+
def create_stable_diffusion_xl_pipeline(device):
|
|
|
|
|
|
|
| 8 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 9 |
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 10 |
)
|
|
|
|
| 14 |
return pipe
|
| 15 |
|
| 16 |
|
| 17 |
+
def create_stable_diffusion_xl_img2img_pipe(device):
|
|
|
|
|
|
|
| 18 |
pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
| 19 |
"stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 20 |
)
|