ford442 commited on
Commit
b42e753
·
verified ·
1 Parent(s): 52b3593

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -85,7 +85,7 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
85
 
86
  def load_and_prepare_model():
87
  #vaeRV = AutoencoderKL.from_pretrained("SG161222/RealVisXL_V5.0", subfolder='vae', safety_checker=None, use_safetensors=True, token=True)
88
- vaeXL = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", safety_checker=None, use_safetensors=False, low_cpu_mem_usage=False, torch_dtype=torch.float32, token=True) #.to(device).to(torch.bfloat16) #.to(device=device, dtype=torch.bfloat16)
89
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True)
90
  #sched = DPMSolverSDEScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler')
91
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", token=True) #, beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True, token=True)
@@ -97,7 +97,7 @@ def load_and_prepare_model():
97
  add_watermarker=False,
98
  #text_encoder=None,
99
  #text_encoder_2=None,
100
- # vae=None,
101
  )
102
  #pipe.vae = vaeXL #.to(torch.bfloat16)
103
  #pipe.scheduler = sched
@@ -111,9 +111,8 @@ def load_and_prepare_model():
111
  #pipe.unet.to(memory_format=torch.channels_last)
112
  #pipe.enable_vae_tiling()
113
  pipe.to(device=device, dtype=torch.bfloat16)
114
- pipe.unet.set_attn_processor(AttnProcessor2_0())
115
  pipe.vae = vaeXL #.to('cpu') #.to(torch.bfloat16)
116
-
117
  pipe.vae.set_default_attn_processor()
118
  return pipe
119
 
 
85
 
86
  def load_and_prepare_model():
87
  #vaeRV = AutoencoderKL.from_pretrained("SG161222/RealVisXL_V5.0", subfolder='vae', safety_checker=None, use_safetensors=True, token=True)
88
+ vaeXL = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", device_map='cpu', safety_checker=None, use_safetensors=False, low_cpu_mem_usage=False, torch_dtype=torch.float32, token=True) #.to(device).to(torch.bfloat16) #.to(device=device, dtype=torch.bfloat16)
89
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True)
90
  #sched = DPMSolverSDEScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler')
91
  #sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", token=True) #, beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True, token=True)
 
97
  add_watermarker=False,
98
  #text_encoder=None,
99
  #text_encoder_2=None,
100
+ vae=None,
101
  )
102
  #pipe.vae = vaeXL #.to(torch.bfloat16)
103
  #pipe.scheduler = sched
 
111
  #pipe.unet.to(memory_format=torch.channels_last)
112
  #pipe.enable_vae_tiling()
113
  pipe.to(device=device, dtype=torch.bfloat16)
 
114
  pipe.vae = vaeXL #.to('cpu') #.to(torch.bfloat16)
115
+ pipe.unet.set_attn_processor(AttnProcessor2_0())
116
  pipe.vae.set_default_attn_processor()
117
  return pipe
118