2024-05-28 17:04:42 +08:00
2024-05-10 11:39:09 +08:00
2024-05-28 17:04:42 +08:00
2024-05-10 11:39:09 +08:00
2024-05-28 17:04:42 +08:00
2024-04-01 13:33:02 +08:00
2024-04-01 05:51:38 +00:00
2024-03-04 14:43:23 +08:00
2023-10-18 17:43:58 +08:00
2023-10-18 17:43:58 +08:00
ss
2023-12-01 21:41:31 +08:00
2023-07-17 09:09:05 +08:00
2024-05-28 17:04:42 +08:00
2023-06-23 07:29:46 +00:00
2024-03-22 11:12:13 +08:00
2023-08-04 08:48:37 +00:00
2024-05-28 17:04:42 +08:00
2024-05-28 17:04:42 +08:00
2024-05-28 17:04:42 +08:00
2023-07-21 18:41:12 +08:00
2023-11-22 10:37:20 +08:00
2024-04-08 09:32:22 +08:00

ComfyUI_Lam

Introduction

A plugin developed based on comfyUI.

Usage Instructions

Download and place in the plugin directory of comfyUI, as shown below:

Alt text

Special Note for this version, execute the latest version "ComfyUI_windows_portable_nvidia_cu118_or_cpu.7z" with cu118 inside, the address is as follows:

https://github.com/comfyanonymous/ComfyUI/releases/download/latest/ComfyUI_windows_portable_nvidia_cu118_or_cpu.7z

  1. Unzip according to the image to the specified plugin directory and name. Extract insightface.rar to the directory ..\ComfyUI_windows_portable\python_embeded\Lib\site-packages. Extract venv.rar to the directory ..\ComfyUI_windows_portable\python_embeded\Lib\site-packages. Then run the install.bat file, and if there are no errors, it's ready.

  2. Model addresses and storage paths: Lama model: https://huggingface.co/lllyasviel/Annotators/resolve/main/ControlNetLama.pth ..\ComfyUI\models\lama\ControlNetLama.pth SadTalker models: https://github.com/OpenTalker/SadTalker/releases/download/v0.0.2-rc/mapping_00109-model.pth.tar ..\ComfyUI\models\SadTalker\mapping_00109-model.pth.tar https://github.com/OpenTalker/SadTalker/releases/download/v0.0.2-rc/mapping_00229-model.pth.tar ..\ComfyUI\models\SadTalker\mapping_00229-model.pth.tar https://github.com/OpenTalker/SadTalker/releases/download/v0.0.2-rc/SadTalker_V0.0.2_256.safetensors ..\ComfyUI\models\SadTalker\SadTalker_V0.0.2_256.safetensors https://github.com/OpenTalker/SadTalker/releases/download/v0.0.2-rc/SadTalker_V0.0.2_512.safetensors ..\ComfyUI\models\SadTalker\SadTalker_V0.0.2_512.safetensors

  3. Gfpgan is based on the startup directory, follow the prompts accordingly. https://github.com/xinntao/facexlib/releases/download/v0.1.0/alignment_WFLW_4HG.pth ..\ComfyUI_windows_portable\gfpgan\weights\alignment_WFLW_4HG.pth https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth ..\ComfyUI_windows_portable\gfpgan\weights\detection_Resnet50_Final.pth https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth ..\ComfyUI_windows_portable\gfpgan\weights\GFPGANv1.4.pth https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth ..\ComfyUI_windows_portable\gfpgan\weights\parsing_parsenet.pth

  4. Image-face-fusion model (Face swapping model) Link: https://pan.baidu.com/s/19DOgJQ_RHNAjfNrzSr2uTQ?pwd=gf0p Extraction Code: gf0p Extract to the directory ..\ComfyUI\models\image-face-fusion

  5. Roop-face-swap model (Face swapping model) Link: https://pan.baidu.com/s/1cJeRtqgdeNW21Hljwuv-tA?pwd=b4yy Extraction Code: b4yy Extract to the directory ..\ComfyUI\models\roop-face-swap

  6. Modify the execution.py file in the comfyUI root directory. 搜索 “def recursive_execute” 位置参考图如下: Alt text 新增内容:

#循环添加代码----------开始----------
def get_del_keys(key, prompt,uniqueIds):
    keys=[]
    for k,v in prompt.items():
        if k in uniqueIds :
            continue
        for k1,v1 in v['inputs'].items():
            if type(v1)==list and v1[0]==key:
                keys.append(k)
                keys=keys+get_del_keys(k,prompt,uniqueIds)
    return keys
#循环添加代码-----------结束---------
#循环添加代码----------开始----------
    startNum=None
    startData={}
    delKeys=[]
    backhaul={}
    clTypes=['ForInnerEnd','IfInnerExecute','DoWhileEnd']
    oldPrompt=None
    if class_type in clTypes:
        oldPrompt=copy.deepcopy(prompt)

    if class_type=='ForInnerEnd':
        startNum=prompt[unique_id]['inputs']['total'][0]
        inputNum=prompt[unique_id]['inputs']['obj'][0]
        maxKeyStr=sorted(list(prompt.keys()), key=lambda x: int(x.split(':')[0]))[-1]
        maxKey = int(maxKeyStr.split(':')[0])
        delKeys=list(set(get_del_keys(startNum,prompt,[startNum,unique_id]))) 
        delKeys.append(startNum)
        delKeys = list(filter(lambda x: x != inputNum, delKeys))
        for key in delKeys:
            outputs.pop(key, None)
        
        startInput=prompt[startNum]['inputs']
        if isinstance(startInput['total'],list) or isinstance(startInput['stop'],list) or isinstance(startInput['i'],list):
            result = recursive_execute(server, prompt, outputs, startNum, extra_data, executed, prompt_id, outputs_ui, object_storage)
            if result[0] is not True:
                    return result
            
        for x in startInput:
            input_data = startInput[x]
            if isinstance(input_data, list):
                startData[x]=outputs[input_data[0]][input_data[1]][0]
            else:
                startData[x]=input_data

        for i in range(startData['i']+1,startData['total'],startData['stop']):
            prompt[str(maxKey+i)]=prompt[inputNum]
            prompt[unique_id]['inputs']['obj'+str(i)]=[str(maxKey+i),prompt[unique_id]['inputs']['obj'][-1]]
            if i==startInput['i']+1:
                backhaul['obj'+str(i)]=prompt[unique_id]['inputs']['obj']
            else:
                backhaul['obj'+str(i)]=[str(maxKey+i-startInput['stop']),prompt[unique_id]['inputs']['obj'][-1]]
    elif class_type=='DoWhileEnd':
        startNum=prompt[unique_id]['inputs']['start'][0]
        inputNum=prompt[unique_id]['inputs']['ANY'][0]
        delKeys=list(set(get_del_keys(startNum,prompt,[startNum,unique_id]))) 
        delKeys.append(startNum)
        delKeys.append(inputNum)

    #循环添加代码-----------结束---------
                #循环添加代码----------开始----------
                if class_type=='ForInnerEnd' and x !='obj' and x.startswith('obj'):
                    if startNum!=None:
                        if isinstance(prompt[startNum]['inputs']['i'],list):
                            prompt[startNum]['inputs']['i']=startData['i']+startData['stop']
                        else:
                            prompt[startNum]['inputs']['i']=prompt[startNum]['inputs']['i']+startData['stop']
                        prompt[startNum]['inputs']['obj']=backhaul[x]
                        for key in delKeys:
                            outputs.pop(key, None)
                #循环添加代码-----------结束---------
                #判断选择添加代码-----------开始---------
                if class_type=='DoWhileEnd' and x == 'ANY':
                    any=outputs[inputNum][prompt[unique_id]['inputs']['ANY'][1]][0]
                    i=0
                    while any:
                        for key in delKeys:
                            outputs.pop(key, None)
                        i=i+1
                        outputs['i']=[[i]]
                        prompt[startNum]['inputs']['i']=['i',0]
                        result = recursive_execute(server, prompt, outputs, input_unique_id, extra_data, executed, prompt_id, outputs_ui, object_storage)
                        if result[0] is not True:
                            return result
                        any=outputs[inputNum][prompt[unique_id]['inputs']['ANY'][1]][0]
            
            if class_type=='IfInnerExecute' and x=='ANY':
                if outputs[input_unique_id][output_index][0]:
                    inputs['IF_FALSE']=oldPrompt[unique_id]['inputs']['IF_TRUE']
                else:
                    inputs['IF_TRUE']=oldPrompt[unique_id]['inputs']['IF_FALSE']
            #判断选择添加代码-----------结束---------
        #循环添加代码----------开始----------
        if class_type=='ForInnerEnd' or class_type=='DoWhileEnd':
            prompt[startNum]['inputs']=oldPrompt[startNum]['inputs']
            prompt[unique_id]['inputs']=oldPrompt[unique_id]['inputs']
            outputs.pop(startNum, None)
            result = recursive_execute(server, prompt, outputs, startNum, extra_data, executed, prompt_id, outputs_ui, object_storage)
            if result[0] is not True:
                   return result
        if class_type=='IfInnerExecute':
            prompt[unique_id]['inputs']=oldPrompt[unique_id]['inputs']
        #循环添加代码-----------结束---------

搜索 “def validate_prompt

'''优化输出开始'''
    inputKeys=[]
    for k,v in prompt.items():
        for k1,v1 in v['inputs'].items():
            if type(v1)==list and len(v1)==2:
                inputKeys.append(v1[0])
    for x in prompt:
        class_ = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']]
        if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE == True and x not in inputKeys:
            outputs.add(x)
    '''优化输出结束'''
S
Description
No description provided
Readme Apache-2.0
107 MiB
Languages
Python 60.6%
JavaScript 32.4%
CSS 3.8%
HTML 3%