blanchon commited on
Commit
7dc5249
·
1 Parent(s): 83d9969

🩹 Fix: use float32 on cpu

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -22,14 +22,14 @@ def main():
22
 
23
  controlnet_tile = ControlNetModel.from_pretrained(
24
  "lllyasviel/control_v11f1e_sd15_tile",
25
- torch_dtype=torch.float16,
26
  use_safetensors=False,
27
  cache_dir="./cache"
28
  ).to(device)
29
 
30
  controlnet_brightness = ControlNetModel.from_pretrained(
31
  "ioclab/control_v1p_sd15_brightness",
32
- torch_dtype=torch.float16,
33
  use_safetensors=True,
34
  cache_dir="./cache"
35
  ).to(device)
@@ -38,7 +38,7 @@ def main():
38
  pipe = StableDiffusionControlNetPipeline.from_pretrained(
39
  hf_repo,
40
  controlnet=[controlnet_tile, controlnet_brightness],
41
- torch_dtype=torch.float16,
42
  cache_dir="./cache",
43
  )
44
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
@@ -183,6 +183,17 @@ def main():
183
  type="pil",
184
  ),
185
  examples=[
 
 
 
 
 
 
 
 
 
 
 
186
  [
187
  "DreamShaper",
188
  "https://twitter.com/JulienBlanchon",
 
22
 
23
  controlnet_tile = ControlNetModel.from_pretrained(
24
  "lllyasviel/control_v11f1e_sd15_tile",
25
+ torch_dtype=torch.float16 if device == "cuda" else torch.float32,
26
  use_safetensors=False,
27
  cache_dir="./cache"
28
  ).to(device)
29
 
30
  controlnet_brightness = ControlNetModel.from_pretrained(
31
  "ioclab/control_v1p_sd15_brightness",
32
+ torch_dtype=torch.float16 if device == "cuda" else torch.float32,
33
  use_safetensors=True,
34
  cache_dir="./cache"
35
  ).to(device)
 
38
  pipe = StableDiffusionControlNetPipeline.from_pretrained(
39
  hf_repo,
40
  controlnet=[controlnet_tile, controlnet_brightness],
41
+ torch_dtype=torch.float16 if device == "cuda" else torch.float32,
42
  cache_dir="./cache",
43
  )
44
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
 
183
  type="pil",
184
  ),
185
  examples=[
186
+ [
187
+ "DreamShaper",
188
+ "https://twitter.com/JulienBlanchon",
189
+ "rock, mountain",
190
+ "",
191
+ 100,
192
+ 9,
193
+ 0.25,
194
+ 0.45,
195
+ 1,
196
+ ],
197
  [
198
  "DreamShaper",
199
  "https://twitter.com/JulienBlanchon",