ford442 commited on
Commit
2505a50
Β·
1 Parent(s): e43edfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -113,15 +113,16 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
113
  def load_and_prepare_model(model_id):
114
  model_dtypes = {"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,}
115
  dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
116
- vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None).to('cuda')
117
- # vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
118
  pipe = StableDiffusionXLPipeline.from_pretrained(
119
  model_id,
120
- torch_dtype=torch.bfloat16,
121
  add_watermarker=False,
122
  use_safetensors=True,
123
  vae=vae,
124
  )
 
125
  pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
126
  pipe.to('cuda')
127
  #pipe.to(device=device, dtype=torch.bfloat16)
 
113
  def load_and_prepare_model(model_id):
114
  model_dtypes = {"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,}
115
  dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
116
+ # vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None).to('cuda')
117
+ vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
118
  pipe = StableDiffusionXLPipeline.from_pretrained(
119
  model_id,
120
+ # torch_dtype=torch.bfloat16,
121
  add_watermarker=False,
122
  use_safetensors=True,
123
  vae=vae,
124
  )
125
+ pipe.unet.to(torch.bfloat16)
126
  pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
127
  pipe.to('cuda')
128
  #pipe.to(device=device, dtype=torch.bfloat16)