Skip to content

Commit

Permalink
Support for LoRA model lcm-lora-sdxl-turbo to all eligibles modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Woolverine94 committed May 28, 2024
1 parent baddd13 commit 7185f6e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 == "")):
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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 == "")):
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7185f6e

Please sign in to comment.