Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -389,45 +389,17 @@ def load_and_prepare_model():
|
|
389 |
#sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler')
|
390 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
391 |
'ford442/RealVisXL_V5.0_BF16',
|
392 |
-
#torch_dtype=torch.bfloat16,
|
393 |
add_watermarker=False,
|
394 |
-
# low_cpu_mem_usage = False,
|
395 |
token = HF_TOKEN,
|
396 |
-
# scheduler = sched,
|
397 |
)
|
398 |
-
#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)
|
399 |
pipe.vae = vaeXL #.to(torch.bfloat16)
|
400 |
pipe.scheduler = sched
|
401 |
-
|
402 |
pipe.vae.do_resize = False
|
403 |
-
#pipe.vae.vae_scale_factor = 8
|
404 |
pipe.vae.do_convert_rgb = True
|
405 |
-
|
406 |
pipe.vae.set_default_attn_processor()
|
407 |
-
#pipe.to(device)
|
408 |
-
#pipe.to(torch.bfloat16)
|
409 |
print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
|
410 |
pipe.watermark=None
|
411 |
pipe.safety_checker=None
|
412 |
-
|
413 |
-
''' # Freeze vae and unet
|
414 |
-
pipe.vae.requires_grad_(False)
|
415 |
-
pipe.unet.requires_grad_(False)
|
416 |
-
pipe.text_encoder.requires_grad_(False)
|
417 |
-
pipe.unet.eval()
|
418 |
-
pipe.vae.eval()
|
419 |
-
pipe.text_encoder.eval()
|
420 |
-
'''
|
421 |
-
#pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
422 |
-
#pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/FLUX-dev-lora-add_details.safetensors", low_cpu_mem_usage=False)
|
423 |
-
#pipe.unet.to(memory_format=torch.channels_last)
|
424 |
-
#pipe.enable_vae_tiling()
|
425 |
-
#pipe.unet = torch.compile(pipe.unet, backend="hidet", dynamic=False, mode='max-autotune') #.to(device=device, dtype=torch.bfloat16)
|
426 |
-
#pipe.unet = torch.compile(pipe.unet, backend="hidet", dynamic=False, mode='max-autotune-no-cudagraphs') #.to(device=device, dtype=torch.bfloat16)
|
427 |
-
#pipe.unet = torch.compile(pipe.unet, backend="hidet", dynamic=False, options={'epilogue_fusion': True, 'shape_padding': True}) #.to(device=device, dtype=torch.bfloat16)
|
428 |
-
#pipe.unet = torch.compile(pipe.unet, dynamic=False)
|
429 |
-
#pipe.unet = torch.compile(pipe.unet, backend="hidet", dynamic=False, options={"search_space": 0})
|
430 |
-
#pipe.unet = torch.compile(pipe.unet, backend="torch_tensorrt", dynamic=False, options={"precision": torch.bfloat16,"optimization_level": 4,})
|
431 |
pipe.to(torch.device('cuda:0'), torch.bfloat16)
|
432 |
|
433 |
return pipe
|
|
|
389 |
#sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler')
|
390 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
391 |
'ford442/RealVisXL_V5.0_BF16',
|
|
|
392 |
add_watermarker=False,
|
|
|
393 |
token = HF_TOKEN,
|
|
|
394 |
)
|
|
|
395 |
pipe.vae = vaeXL #.to(torch.bfloat16)
|
396 |
pipe.scheduler = sched
|
|
|
397 |
pipe.vae.do_resize = False
|
|
|
398 |
pipe.vae.do_convert_rgb = True
|
|
|
399 |
pipe.vae.set_default_attn_processor()
|
|
|
|
|
400 |
print(f'init noise scale: {pipe.scheduler.init_noise_sigma}')
|
401 |
pipe.watermark=None
|
402 |
pipe.safety_checker=None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
pipe.to(torch.device('cuda:0'), torch.bfloat16)
|
404 |
|
405 |
return pipe
|