ar0551 commited on
Commit
e60d8ba
·
verified ·
1 Parent(s): 333ce15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -8,8 +8,8 @@ from PIL import Image
8
  import spaces
9
 
10
  # 🌟 Auto-detect device (CPU/GPU)
11
- device = "cuda" if torch.cuda.is_available() else "cpu"
12
- precision = torch.float16 if device == "cuda" else torch.float32
13
 
14
 
15
  eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
@@ -21,13 +21,13 @@ controlnet = ControlNetModel.from_pretrained(
21
  )
22
 
23
  # when test with other base model, you need to change the vae also.
24
- vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
25
 
26
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
27
  "stabilityai/stable-diffusion-xl-base-1.0",
28
  controlnet=controlnet,
29
  vae=vae,
30
- torch_dtype=torch.float16,
31
  scheduler=eulera_scheduler,
32
  )
33
 
 
8
  import spaces
9
 
10
  # 🌟 Auto-detect device (CPU/GPU)
11
+ device = "cuda"
12
+ precision = torch.float16
13
 
14
 
15
  eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
 
21
  )
22
 
23
  # when test with other base model, you need to change the vae also.
24
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=precision)
25
 
26
  pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
27
  "stabilityai/stable-diffusion-xl-base-1.0",
28
  controlnet=controlnet,
29
  vae=vae,
30
+ torch_dtype=precision,
31
  scheduler=eulera_scheduler,
32
  )
33