|
|
|
@ -2779,7 +2779,23 @@ class SEQUENCER_OT_generate_image(Operator):
|
|
|
|
|
pipe.scheduler.config |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# LORA TESTS |
|
|
|
|
pipe.watermark = NoWatermark() |
|
|
|
|
|
|
|
|
|
if low_vram(): |
|
|
|
|
# torch.cuda.set_per_process_memory_fraction(0.95) # 6 GB VRAM |
|
|
|
|
pipe.enable_model_cpu_offload() |
|
|
|
|
pipe.enable_vae_slicing() |
|
|
|
|
else: |
|
|
|
|
pipe.to("cuda") |
|
|
|
|
|
|
|
|
|
if scene.use_freeU and pipe: # Free Lunch |
|
|
|
|
# -------- freeu block registration |
|
|
|
|
print("Process: FreeU") |
|
|
|
|
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) |
|
|
|
|
register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) |
|
|
|
|
# -------- freeu block registration |
|
|
|
|
|
|
|
|
|
# LoRA SDXL |
|
|
|
|
if image_model_card == "stabilityai/stable-diffusion-xl-base-1.0": |
|
|
|
|
|
|
|
|
|
scene = context.scene |
|
|
|
@ -2787,7 +2803,7 @@ class SEQUENCER_OT_generate_image(Operator):
|
|
|
|
|
enabled_names = [] |
|
|
|
|
enabled_weights = [] |
|
|
|
|
|
|
|
|
|
# Check if there are any enabled items before printing |
|
|
|
|
# Check if there are any enabled items before loading |
|
|
|
|
enabled_items = [item for item in lora_files if item.enabled] |
|
|
|
|
if enabled_items: |
|
|
|
|
for item in enabled_items: |
|
|
|
@ -2796,36 +2812,12 @@ class SEQUENCER_OT_generate_image(Operator):
|
|
|
|
|
pipe.load_lora_weights(scene.lora_folder, weight_name=item.name+".safetensors", adapter_name=((clean_filename(item.name)).replace(".",""))) |
|
|
|
|
|
|
|
|
|
pipe.set_adapters(enabled_names, adapter_weights=enabled_weights) |
|
|
|
|
print("Load LoRAs: " + ' '.join(enabled_names)) |
|
|
|
|
|
|
|
|
|
# for item in lora_files: |
|
|
|
|
# print(f"Name: {item.name}, Enabled: {item.enabled}, Weight: {item.weight_value}") |
|
|
|
|
|
|
|
|
|
#pipe.unet.load_attn_procs("C:/Users/45239/Documents/LORA/filmgrain_v1.safetensors") |
|
|
|
|
# pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="DavidLynch-10.safetensors") |
|
|
|
|
# pipe.fuse_lora(lora_scale=0.7) |
|
|
|
|
# pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="KlausKinski-06.safetensors") |
|
|
|
|
# pipe.fuse_lora(lora_scale=0.7) |
|
|
|
|
#pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="Willem_Dafoev1.safetensors") |
|
|
|
|
# pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="SDXL_Inkdrawing_v1.safetensors") |
|
|
|
|
# pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="WH1.safetensors") |
|
|
|
|
# pipe.load_lora_weights("C:/Users/45239/Documents/LORA/", weight_name="AnalogRedmondV2-Analog-AnalogRedmAF.safetensors") |
|
|
|
|
# SD 1.5 |
|
|
|
|
# pipe.load_lora_weights("C:/Users/user_name/Documents/LORA/", weight_name="AnalogRedmondV2-Analog-AnalogRedmAF.safetensors") |
|
|
|
|
# #pipe.fuse_lora(lora_scale=0.7) |
|
|
|
|
|
|
|
|
|
pipe.watermark = NoWatermark() |
|
|
|
|
|
|
|
|
|
if low_vram(): |
|
|
|
|
# torch.cuda.set_per_process_memory_fraction(0.95) # 6 GB VRAM |
|
|
|
|
pipe.enable_model_cpu_offload() |
|
|
|
|
pipe.enable_vae_slicing() |
|
|
|
|
else: |
|
|
|
|
pipe.to("cuda") |
|
|
|
|
|
|
|
|
|
if scene.use_freeU and pipe: # Free Lunch |
|
|
|
|
# -------- freeu block registration |
|
|
|
|
print("Process: FreeU") |
|
|
|
|
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) |
|
|
|
|
register_free_crossattn_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4) |
|
|
|
|
# -------- freeu block registration |
|
|
|
|
|
|
|
|
|
# load refiner model if chosen. |
|
|
|
|
if do_refine: |
|
|
|
|