multimodalart HF staff commited on
Commit
00f6a78
1 Parent(s): 4cdfd9c

Update base model, better vae

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -4,6 +4,7 @@ import gradio as gr
4
  from PIL import Image
5
  from diffusers import (
6
  DiffusionPipeline,
 
7
  StableDiffusionControlNetPipeline,
8
  ControlNetModel,
9
  StableDiffusionLatentUpscalePipeline,
@@ -11,18 +12,22 @@ from diffusers import (
11
  EulerDiscreteScheduler # <-- Added import
12
  )
13
 
 
 
14
  # Initialize both pipelines
15
- init_pipe = DiffusionPipeline.from_pretrained("SG161222/Realistic_Vision_V2.0", torch_dtype=torch.float16).to("cuda")
 
16
  controlnet = ControlNetModel.from_pretrained("monster-labs/control_v1p_sd15_qrcode_monster", torch_dtype=torch.float16)
17
  main_pipe = StableDiffusionControlNetPipeline.from_pretrained(
18
- "SG161222/Realistic_Vision_V2.0",
19
  controlnet=controlnet,
 
20
  safety_checker=None,
21
  torch_dtype=torch.float16,
22
  ).to("cuda")
23
- model_id = "stabilityai/sd-x2-latent-upscaler"
24
- upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
25
- upscaler.to("cuda")
26
 
27
 
28
  # Sampler map
 
4
  from PIL import Image
5
  from diffusers import (
6
  DiffusionPipeline,
7
+ AutoencoderKL,
8
  StableDiffusionControlNetPipeline,
9
  ControlNetModel,
10
  StableDiffusionLatentUpscalePipeline,
 
12
  EulerDiscreteScheduler # <-- Added import
13
  )
14
 
15
+ BASE_MODEL = "SG161222/Realistic_Vision_V5.1_noVAE"
16
+
17
  # Initialize both pipelines
18
+ vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
19
+ #init_pipe = DiffusionPipeline.from_pretrained("SG161222/Realistic_Vision_V5.1_noVAE", torch_dtype=torch.float16)
20
  controlnet = ControlNetModel.from_pretrained("monster-labs/control_v1p_sd15_qrcode_monster", torch_dtype=torch.float16)
21
  main_pipe = StableDiffusionControlNetPipeline.from_pretrained(
22
+ BASE_MODEL,
23
  controlnet=controlnet,
24
+ vae=vae,
25
  safety_checker=None,
26
  torch_dtype=torch.float16,
27
  ).to("cuda")
28
+ #model_id = "stabilityai/sd-x2-latent-upscaler"
29
+ #upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
30
+ #upscaler.to("cuda")
31
 
32
 
33
  # Sampler map