Andre Embury commited on
Commit
79c322a
·
unverified ·
1 Parent(s): ea33a01

Try use SDXL with other controlnet

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -5,8 +5,9 @@ import numpy as np
5
 
6
  # import spaces #[uncomment to use ZeroGPU]
7
  from diffusers import (
8
- StableDiffusionControlNetImg2ImgPipeline,
9
  ControlNetModel,
 
10
  )
11
  import torch
12
 
@@ -24,17 +25,28 @@ if torch.cuda.is_available():
24
  else:
25
  torch_dtype = torch.float32
26
 
 
 
 
 
27
  controlnet = ControlNetModel.from_pretrained(
28
- "lllyasviel/sd-controlnet-canny", torch_dtype=torch.float32
29
  )
30
 
31
  # pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
32
- pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
33
- model_repo_id,
 
 
 
 
 
34
  controlnet=controlnet,
35
- torch_dtype=torch_dtype,
 
 
36
  ).to(device)
37
- pipe = pipe.to(device)
38
  canny = CannyDetector()
39
 
40
  MAX_SEED = np.iinfo(np.int32).max
 
5
 
6
  # import spaces #[uncomment to use ZeroGPU]
7
  from diffusers import (
8
+ # StableDiffusionControlNetImg2ImgPipeline,
9
  ControlNetModel,
10
+ StableDiffusionXLControlNetPipeline,
11
  )
12
  import torch
13
 
 
25
  else:
26
  torch_dtype = torch.float32
27
 
28
+ # controlnet = ControlNetModel.from_pretrained(
29
+ # "lllyasviel/sd-controlnet-canny", torch_dtype=torch.float32
30
+ # )
31
+
32
  controlnet = ControlNetModel.from_pretrained(
33
+ "diffusers/controlnet-canny-sdxl-1.0", torch_dtype=torch.float16
34
  )
35
 
36
  # pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
37
+ # pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
38
+ # model_repo_id,
39
+ # controlnet=controlnet,
40
+ # torch_dtype=torch_dtype,
41
+ # ).to(device)
42
+ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
43
+ "stabilityai/stable-diffusion-xl-base-1.0",
44
  controlnet=controlnet,
45
+ torch_dtype=torch.float16,
46
+ variant="fp16",
47
+ use_safetensors=True,
48
  ).to(device)
49
+ # pipe = pipe.to(device)
50
  canny = CannyDetector()
51
 
52
  MAX_SEED = np.iinfo(np.int32).max