taabata / LCM_Inpaint_Outpaint_Comfy

ComfyUI custom nodes for inpainting/outpainting using the new latent consistency model (LCM)
244 stars 17 forks source link

LCMGenerate error unexpected argument "mask_image" #17

Open abcnorio opened 10 months ago

abcnorio commented 10 months ago

Hi,

first - somewhere for the default

raw.githubusercontent.com_taabata_LCM_Inpaint_Outpaint_Comfy_main_inpaint_LCMLORA_promptless.json

fails to run as it contains somewhere in the code

LCM_Inpaint_Outpaint_Comfy

instead of

LCM_Inpaint-Outpaint_Comfy

and the "masquerade nodes" is not compatible with some other node (had to substitute that). Then the node went fine.

BUT using promptless outpainting:

tried the "Screenshot from 2023-10-29 03-32-29.png" promptless outpaint. Updated ALL incl. custom nodes/ comfyui etc. before applying. controlnet model is 'control_v11p_sd15_inpainting'. Nodes are exactly as described.

Result:


Error occurred when executing LCMGenerate:

LatentConsistencyModelPipeline_reference_img2img.__call__() got an unexpected keyword argument 'mask_image'

File "***/ComfyUI/execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "***/ComfyUI/execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File ***/ComfyUI/execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "***/ComfyUI/custom_nodes/LCM_Inpaint-Outpaint_Comfy/LCM_Nodes.py", line 842, in mainfunc
images = pipe(prompt=prompt, num_images_per_prompt=1, num_inference_steps=steps, guidance_scale=cfg, lcm_origin_steps=50,width=width,height=height,strength = 1.0, image=image, mask_image=mask).images
File "***/miniconda3/envs/CUISDXL/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)

note: personal paths on the computer are marked as "***" (it's not a path problem).

thanks!

taabata commented 10 months ago

Sorry for that, but hat node and workflow are outdated. If you wish to inpaint/outpaint with reference i recommend using these new nodes for better results with similar speed. Instructions:

Clone the github repository into the custom_nodes folder in your ComfyUI directory

Run the setup script for the CanvasTool

Install any sd 1.5 based model in diffusers format (like this one https://huggingface.co/stablediffusionapi/deliberate-v2/tree/main) and place in models/diffusers folder in your ComfyUI directory

Install LCM_lora from https://huggingface.co/latent-consistency/lcm-lora-sdv1-5/tree/main and place in models/loras folder in your ComfyUI directory

Install controlnet inpaint model in diffusers format (from https://huggingface.co/lllyasviel/control_v11p_sd15_inpaint/tree/main) and place in models/controlnet folder in your ComfyUI directory

Install ip adapter models and image encoder and place in models/controlnet/IPAdapter (you have to create the folder) in your ComfyUI directory (optional; can use reference only instead)

Open the workflow in ComfyUI (https://github.com/taabata/LCM_Inpaint_Outpaint_Comfy/blob/main/inpaint_LCMLORA_promptless.json)

Also for the 'Get image size' node, you need to git clone https://github.com/BadCafeCode/masquerade-nodes-comfyui in your custom_nodes folder

Image resize node from https://github.com/WASasquatch/was-node-suite-comfyui

(demo on reddit https://www.reddit.com/r/StableDiffusion/comments/189ejsd/promptless_inpaintoutpaint_in_comfyui_made_easier/?utm_source=share&utm_medium=web2x&context=3)

abcnorio commented 9 months ago

Thanks,

(1) now the error shifted to missing data.json file within CanvasTool

[Errno 2] No such file or directory: 'ComfyUI/custom_nodes/LCM_Inpaint_Outpaint_Comfy/CanvasTool/data.json'

File "ComfyUI/execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "ComfyUI/execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "ComfyUI/execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "ComfyUI/custom_nodes/LCM_Inpaint_Outpaint_Comfy/LCM_Nodes.py", line 2051, in canvasopen
with open(folder_paths.get_folder_paths("custom_nodes")[0]+"/LCM_Inpaint_Outpaint_Comfy/CanvasTool/data.json","r") as json_file:

Where do I get this file, it is not in the repo?

(2) Mask

What kind of mask is expected? As we do outpaint the original image does not really have a mask, right? So just copy the original image?

(3) Image resolution

Then - "cropped" means to be cropped to a value you can divide by 8 for width and height?

Maybe you can be so kind to add an example with mask and cropped image to the git repo within canvastool as there is none. and the example expects image, cropped, and mask to be there per default.

Thanks!