ford442 commited on
Commit
89403fe
·
1 Parent(s): 4d779d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -107,7 +107,9 @@ def load_and_prepare_model(model_id):
107
  dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
108
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None).to('cuda')
109
  vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float32,safety_checker=None).to(torch.bfloat16)
110
- # vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors", torch_dtype=torch.float32,safety_checker=None).to(torch.bfloat16)
 
 
111
  # vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
112
  pipe = StableDiffusionXLPipeline.from_pretrained(
113
  model_id,
@@ -115,14 +117,14 @@ def load_and_prepare_model(model_id):
115
  add_watermarker=False,
116
  use_safetensors=True,
117
  vae=vae,
 
118
  ).to('cuda')
119
  # pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
120
  #pipe.to(device=device, dtype=torch.bfloat16)
121
  #sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
122
- sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start =0.00085,beta_end =0.012,steps_offset =1,)
123
  #sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
124
  #sched = DDIMScheduler.from_config(pipe.scheduler.config)
125
- pipe.scheduler=sched
126
  return pipe
127
 
128
  # Preload and compile both models
 
107
  dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
108
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None).to('cuda')
109
  vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float32,safety_checker=None).to(torch.bfloat16)
110
+ sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start =0.00085,beta_end =0.012,steps_offset =1,)
111
+
112
+ # vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors", torch_dtype=torch.float32,safety_checker=None).to(torch.bfloat16)
113
  # vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
114
  pipe = StableDiffusionXLPipeline.from_pretrained(
115
  model_id,
 
117
  add_watermarker=False,
118
  use_safetensors=True,
119
  vae=vae,
120
+ scheduler=sched
121
  ).to('cuda')
122
  # pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
123
  #pipe.to(device=device, dtype=torch.bfloat16)
124
  #sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
 
125
  #sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
126
  #sched = DDIMScheduler.from_config(pipe.scheduler.config)
127
+ #pipe.scheduler=sched
128
  return pipe
129
 
130
  # Preload and compile both models