From 7185f6ec8078f811916f94092a690ed89fbe93b5 Mon Sep 17 00:00:00 2001 From: Woolverine94 Date: Wed, 29 May 2024 00:10:26 +0200 Subject: [PATCH] Support for LoRA model lcm-lora-sdxl-turbo to all eligibles modules --- webui.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/webui.py b/webui.py index ea69321..4ff1d5d 100644 --- a/webui.py +++ b/webui.py @@ -469,7 +469,7 @@ def change_lora_model_txt2img_lcm(model, lora_model, prompt, steps, cfg_scale, s lora_prompt_txt2img_lcm = lora_prompt_txt2img_lcm.replace(lora_trigger, "") biniou_internal_previous_trigger_txt2img_lcm = lora_keyword - if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): + if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or (lora_model == "openskyml/lcm-lora-sdxl-turbo") or ("H1T/TCD-SD" in lora_model.upper()): biniou_internal_previous_model_txt2img_lcm = model biniou_internal_previous_steps_txt2img_lcm = steps biniou_internal_previous_cfg_txt2img_lcm = cfg_scale @@ -478,6 +478,8 @@ def change_lora_model_txt2img_lcm(model, lora_model, prompt, steps, cfg_scale, s return prompt_txt2img_lcm.update(value=lora_prompt_txt2img_lcm), num_inference_step_txt2img_lcm.update(value=4), guidance_scale_txt2img_lcm.update(value=0.0), sampler_txt2img_lcm.update(value="LCM") elif (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): return prompt_txt2img_lcm.update(value=lora_prompt_txt2img_lcm), num_inference_step_txt2img_lcm.update(value=2), guidance_scale_txt2img_lcm.update(value=0.0), sampler_txt2img_lcm.update(value="TCD") + elif (lora_model == "openskyml/lcm-lora-sdxl-turbo"): + return prompt_txt2img_lcm.update(value=lora_prompt_txt2img_lcm), num_inference_step_txt2img_lcm.update(value=4), guidance_scale_txt2img_lcm.update(value=0.0), sampler_txt2img_lcm.update(value="LCM") else: if ((biniou_internal_previous_model_txt2img_lcm == "") and (biniou_internal_previous_steps_txt2img_lcm == "") and (biniou_internal_previous_cfg_txt2img_lcm == "") and (biniou_internal_previous_sampler_txt2img_lcm == "")): @@ -615,7 +617,7 @@ def change_lora_model_img2img(model, lora_model, prompt, steps, cfg_scale, sampl lora_prompt_img2img = lora_prompt_img2img.replace(lora_trigger, "") biniou_internal_previous_trigger_img2img = lora_keyword - if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): + if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or (lora_model == "openskyml/lcm-lora-sdxl-turbo") or ("H1T/TCD-SD" in lora_model.upper()): biniou_internal_previous_model_img2img = model biniou_internal_previous_steps_img2img = steps biniou_internal_previous_cfg_img2img = cfg_scale @@ -624,6 +626,8 @@ def change_lora_model_img2img(model, lora_model, prompt, steps, cfg_scale, sampl return prompt_img2img.update(value=lora_prompt_img2img), num_inference_step_img2img.update(value=4), guidance_scale_img2img.update(value=0.0), sampler_img2img.update(value="LCM") elif (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): return prompt_img2img.update(value=lora_prompt_img2img), num_inference_step_img2img.update(value=4), guidance_scale_img2img.update(value=0.0), sampler_img2img.update(value="TCD") + if (lora_model == "openskyml/lcm-lora-sdxl-turbo"): + return prompt_img2img.update(value=lora_prompt_img2img), num_inference_step_img2img.update(value=4), guidance_scale_img2img.update(value=0.0), sampler_img2img.update(value="LCM") else: if ((biniou_internal_previous_model_img2img == "") and (biniou_internal_previous_steps_img2img == "") and (biniou_internal_previous_cfg_img2img == "") and (biniou_internal_previous_sampler_img2img == "")): return prompt_img2img.update(value=lora_prompt_img2img), num_inference_step_img2img.update(), guidance_scale_img2img.update(), sampler_img2img.update() @@ -757,7 +761,7 @@ def change_lora_model_img2img_ip(model, lora_model, prompt, steps, cfg_scale, sa lora_prompt_img2img_ip = lora_prompt_img2img_ip.replace(lora_trigger, "") biniou_internal_previous_trigger_img2img_ip = lora_keyword - if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): + if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or (lora_model == "openskyml/lcm-lora-sdxl-turbo") or ("H1T/TCD-SD" in lora_model.upper()): biniou_internal_previous_model_img2img_ip = model biniou_internal_previous_steps_img2img_ip = steps biniou_internal_previous_cfg_img2img_ip = cfg_scale @@ -766,6 +770,8 @@ def change_lora_model_img2img_ip(model, lora_model, prompt, steps, cfg_scale, sa return prompt_img2img_ip.update(value=lora_prompt_img2img_ip), num_inference_step_img2img_ip.update(value=4), guidance_scale_img2img_ip.update(value=0.0), sampler_img2img_ip.update(value="LCM") elif (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): return prompt_img2img_ip.update(value=lora_prompt_img2img_ip), num_inference_step_img2img_ip.update(value=2), guidance_scale_img2img_ip.update(value=0.0), sampler_img2img_ip.update(value="TCD") + elif (lora_model == "openskyml/lcm-lora-sdxl-turbo"): + return prompt_img2img_ip.update(value=lora_prompt_img2img_ip), num_inference_step_img2img_ip.update(value=4), guidance_scale_img2img_ip.update(value=0.0), sampler_img2img_ip.update(value="LCM") else: if ((biniou_internal_previous_model_img2img_ip == "") and (biniou_internal_previous_steps_img2img_ip == "") and (biniou_internal_previous_cfg_img2img_ip == "") and (biniou_internal_previous_sampler_img2img_ip == "")): return prompt_img2img_ip.update(value=lora_prompt_img2img_ip), num_inference_step_img2img_ip.update(), guidance_scale_img2img_ip.update(), sampler_img2img_ip.update() @@ -922,7 +928,7 @@ def change_lora_model_controlnet(model, lora_model, prompt, steps, cfg_scale, sa lora_prompt_controlnet = lora_prompt_controlnet.replace(lora_trigger, "") biniou_internal_previous_trigger_controlnet = lora_keyword - if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): + if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or (lora_model == "openskyml/lcm-lora-sdxl-turbo") or ("H1T/TCD-SD" in lora_model.upper()): biniou_internal_previous_model_controlnet = model biniou_internal_previous_steps_controlnet = steps biniou_internal_previous_cfg_controlnet = cfg_scale @@ -931,6 +937,8 @@ def change_lora_model_controlnet(model, lora_model, prompt, steps, cfg_scale, sa return prompt_controlnet.update(value=lora_prompt_controlnet), num_inference_step_controlnet.update(value=4), guidance_scale_controlnet.update(value=0.0), sampler_controlnet.update(value="LCM") elif (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): return prompt_controlnet.update(value=lora_prompt_controlnet), num_inference_step_controlnet.update(value=2), guidance_scale_controlnet.update(value=0.0), sampler_controlnet.update(value="TCD") + elif (lora_model == "openskyml/lcm-lora-sdxl-turbo"): + return prompt_controlnet.update(value=lora_prompt_controlnet), num_inference_step_controlnet.update(value=4), guidance_scale_controlnet.update(value=0.0), sampler_controlnet.update(value="LCM") else: if ((biniou_internal_previous_model_controlnet == "") and (biniou_internal_previous_steps_controlnet == "") and (biniou_internal_previous_cfg_controlnet == "") and (biniou_internal_previous_sampler_controlnet == "")): @@ -1060,15 +1068,17 @@ def change_lora_model_faceid_ip(model, lora_model, prompt, steps, cfg_scale, sam lora_prompt_faceid_ip = lora_prompt_faceid_ip.replace(lora_trigger, "") biniou_internal_previous_trigger_faceid_ip = lora_keyword - if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): + if (lora_model == "ByteDance/SDXL-Lightning") or (lora_model == "ByteDance/Hyper-SD") or (lora_model == "openskyml/lcm-lora-sdxl-turbo") or ("H1T/TCD-SD" in lora_model.upper()): biniou_internal_previous_model_faceid_ip = model biniou_internal_previous_steps_faceid_ip = steps biniou_internal_previous_cfg_faceid_ip = cfg_scale biniou_internal_previous_sampler_faceid_ip = sampler if (lora_model == "ByteDance/SDXL-Lightning"): - return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(value=4), guidance_scale_faceid_ip.update(value=0.0), sampler_faceid_ip.update(value="LCM") + return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(value=4), guidance_scale_faceid_ip.update(value=1.0), sampler_faceid_ip.update(value="LCM") elif (lora_model == "ByteDance/Hyper-SD") or ("H1T/TCD-SD" in lora_model.upper()): - return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(value=2), guidance_scale_faceid_ip.update(value=0.0), sampler_faceid_ip.update(value="TCD") + return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(value=2), guidance_scale_faceid_ip.update(value=1.0), sampler_faceid_ip.update(value="TCD") + elif (lora_model == "openskyml/lcm-lora-sdxl-turbo"): + return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(value=4), guidance_scale_faceid_ip.update(value=1.0), sampler_faceid_ip.update(value="LCM") else: if ((biniou_internal_previous_model_faceid_ip == "") and (biniou_internal_previous_steps_faceid_ip == "") and (biniou_internal_previous_cfg_faceid_ip == "") and (biniou_internal_previous_sampler_faceid_ip == "")): return prompt_faceid_ip.update(value=lora_prompt_faceid_ip), num_inference_step_faceid_ip.update(), guidance_scale_faceid_ip.update(), sampler_faceid_ip.update()