Update app.py
Browse files
app.py
CHANGED
|
@@ -167,7 +167,7 @@ def load_and_prepare_model():
|
|
| 167 |
|
| 168 |
#pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
| 169 |
#pipe.scheduler = DPMSolverMultistepScheduler.from_pretrained('SG161222/RealVisXL_V5.0', subfolder='scheduler', algorithm_type='sde-dpmsolver++')
|
| 170 |
-
pipe.vae = vaeX
|
| 171 |
#pipe.unet = unetX
|
| 172 |
|
| 173 |
#pipe.vae.do_resize=False
|
|
@@ -182,8 +182,8 @@ def load_and_prepare_model():
|
|
| 182 |
#pipe.scheduler=EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear")
|
| 183 |
# pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/Fantasy_World_XL.safetensors", adapter_name="fantasy")
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
| 187 |
|
| 188 |
#pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
|
| 189 |
#pipe.unet.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="unet")
|
|
@@ -192,8 +192,8 @@ def load_and_prepare_model():
|
|
| 192 |
#pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
| 193 |
|
| 194 |
#Some typical diffusers pipeline optimizations
|
| 195 |
-
|
| 196 |
-
|
| 197 |
#pipe.enable_xformers_memory_efficient_attention()
|
| 198 |
|
| 199 |
|
|
@@ -201,8 +201,8 @@ def load_and_prepare_model():
|
|
| 201 |
#pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
|
| 202 |
#pipe.set_adapters(["skin"], adapter_weights=[0.5])
|
| 203 |
#pipe.unet.set_default_attn_processor()
|
| 204 |
-
pipe.to(device)
|
| 205 |
-
pipe.to(torch.bfloat16)
|
| 206 |
|
| 207 |
print(f'Pipeline: ')
|
| 208 |
#print(f'_optional_components: {pipe._optional_components}')
|
|
|
|
| 167 |
|
| 168 |
#pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
| 169 |
#pipe.scheduler = DPMSolverMultistepScheduler.from_pretrained('SG161222/RealVisXL_V5.0', subfolder='scheduler', algorithm_type='sde-dpmsolver++')
|
| 170 |
+
pipe.vae = vaeX #.to(torch.bfloat16)
|
| 171 |
#pipe.unet = unetX
|
| 172 |
|
| 173 |
#pipe.vae.do_resize=False
|
|
|
|
| 182 |
#pipe.scheduler=EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear")
|
| 183 |
# pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/Fantasy_World_XL.safetensors", adapter_name="fantasy")
|
| 184 |
|
| 185 |
+
pipe.vae.set_default_attn_processor()
|
| 186 |
+
pipe.to(device, torch.bfloat16)
|
| 187 |
|
| 188 |
#pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
|
| 189 |
#pipe.unet.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="unet")
|
|
|
|
| 192 |
#pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
| 193 |
|
| 194 |
#Some typical diffusers pipeline optimizations
|
| 195 |
+
pipe.unet.to(memory_format=torch.channels_last) #Unsupported by hidet, but does not seem to make a difference if disabled.
|
| 196 |
+
pipe.enable_vae_tiling()
|
| 197 |
#pipe.enable_xformers_memory_efficient_attention()
|
| 198 |
|
| 199 |
|
|
|
|
| 201 |
#pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
|
| 202 |
#pipe.set_adapters(["skin"], adapter_weights=[0.5])
|
| 203 |
#pipe.unet.set_default_attn_processor()
|
| 204 |
+
#pipe.to(device)
|
| 205 |
+
#pipe.to(torch.bfloat16)
|
| 206 |
|
| 207 |
print(f'Pipeline: ')
|
| 208 |
#print(f'_optional_components: {pipe._optional_components}')
|