forked from larsupb/LoRA-Merger-ComfyUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlora_apply.py
More file actions
28 lines (21 loc) · 844 Bytes
/
lora_apply.py
File metadata and controls
28 lines (21 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import comfy
class LoraApply:
def __init__(self):
self.loaded_lora = None
@classmethod
def INPUT_TYPES(s):
return {"required": {"model": ("MODEL",),
"clip": ("CLIP",),
"lora": ("LoRA",),
}}
RETURN_TYPES = ("MODEL", "CLIP")
FUNCTION = "apply_merged_lora"
CATEGORY = "LoRA PowerMerge"
def apply_merged_lora(self, model, clip, lora):
lora_weight = lora["lora"]
strength_model = lora["strength_model"]
strength_clip = lora["strength_clip"]
if strength_model == 0 and strength_clip == 0:
return (model, clip)
model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora_weight, strength_model, strength_clip)
return (model_lora, clip_lora)