Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,6 +109,7 @@ def load_and_prepare_model(model_id):
|
|
| 109 |
# vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float32,safety_checker=None)
|
| 110 |
# vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors",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,
|
| 114 |
# torch_dtype=torch.bfloat16,
|
|
@@ -121,7 +122,13 @@ def load_and_prepare_model(model_id):
|
|
| 121 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
| 122 |
#pipe.to('cuda')
|
| 123 |
# pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
#sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
|
| 126 |
#sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
|
| 127 |
#sched = DDIMScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 109 |
# vae = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", torch_dtype=torch.float32,safety_checker=None)
|
| 110 |
# vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors",safety_checker=None).to(torch.bfloat16)
|
| 111 |
# vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
|
| 112 |
+
pipeX = StableDiffusionXLPipeline.from_pretrained("SG161222/RealVisXL_V5.0")
|
| 113 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 114 |
model_id,
|
| 115 |
# torch_dtype=torch.bfloat16,
|
|
|
|
| 122 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
| 123 |
#pipe.to('cuda')
|
| 124 |
# pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 125 |
+
|
| 126 |
+
pipe.unet = pipeX.unet
|
| 127 |
+
pipe.to(dtype=torch.bfloat16)
|
| 128 |
+
pipe.to(device)
|
| 129 |
+
|
| 130 |
+
#pipe.to(device, dtype=torch.bfloat16)
|
| 131 |
+
#del pipeX
|
| 132 |
#sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
|
| 133 |
#sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
|
| 134 |
#sched = DDIMScheduler.from_config(pipe.scheduler.config)
|