Fabrice-TIERCELIN
commited on
Parameter for CUDA
Browse files
app.py
CHANGED
@@ -16,9 +16,10 @@ import torch
|
|
16 |
max_64_bit_int = 2**63 - 1
|
17 |
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
-
|
|
|
20 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
21 |
-
"runwayml/stable-diffusion-v1-5", safety_checker = None, controlnet = controlnet, torch_dtype =
|
22 |
)
|
23 |
pipe = pipe.to(device)
|
24 |
|
|
|
16 |
max_64_bit_int = 2**63 - 1
|
17 |
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
+
floatType = torch.float16 if torch.cuda.is_available() else torch.float32
|
20 |
+
controlnet = ControlNetModel.from_pretrained("lllyasviel/control_v11e_sd15_ip2p", torch_dtype = floatType)
|
21 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
22 |
+
"runwayml/stable-diffusion-v1-5", safety_checker = None, controlnet = controlnet, torch_dtype = floatType
|
23 |
)
|
24 |
pipe = pipe.to(device)
|
25 |
|