Fabrice-TIERCELIN commited on
Commit
bd9036b
·
verified ·
1 Parent(s): f7b2641

Parameter for CUDA

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- controlnet = ControlNetModel.from_pretrained("lllyasviel/control_v11e_sd15_ip2p", torch_dtype = torch.float32)
 
20
  pipe = StableDiffusionControlNetPipeline.from_pretrained(
21
- "runwayml/stable-diffusion-v1-5", safety_checker = None, controlnet = controlnet, torch_dtype = torch.float32
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