0xbitches / ComfyUI-LCM

Latent Consistency Model for ComfyUI
GNU General Public License v3.0
252 stars 16 forks source link

"Make sure `_init_weights` is implemented for" error #4

Closed Starnub closed 11 months ago

Starnub commented 11 months ago

Sorry I'm not very tech knowledgable so I might be missing something simple, but I cloned the repo into my custom nodes, set up the LCM Sampler in what I assume is the correct workflow, and ran it; it downloaded a bunch of models but then produced this error:

image

I tried toggling the fp16 thing as well. Here's the error in text format:

`Error occurred when executing LCM_Sampler:

Make sure '_init_weights' is implemented for

File "C:\ComfyUI\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "C:\ComfyUI\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 "C:\ComfyUI\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "C:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-LCM\nodes.py", line 46, in sample self.pipe = LatentConsistencyModelPipeline.from_pretrained( File "C:\ComfyUI\python_embeded\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1105, in from_pretrained loaded_sub_model = load_sub_model( File "C:\ComfyUI\python_embeded\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 472, in load_sub_model loaded_sub_model = load_method(os.path.join(cached_folder, name), loading_kwargs) File "C:\ComfyUI\python_embeded\lib\site-packages\transformers\modeling_utils.py", line 2478, in from_pretrained ) = cls._load_pretrained_model( File "C:\ComfyUI\python_embeded\lib\site-packages\transformers\modeling_utils.py", line 2665, in _load_pretrained_model model._init_weights(module) File "C:\ComfyUI\python_embeded\lib\site-packages\transformers\modeling_utils.py", line 1170, in _init_weights raise NotImplementedError(f"Make sure '_init_weights' is implemented for {self.class}")`

futureengine-io commented 11 months ago

Same here.

toyxyz commented 11 months ago

Same here too

osi1880vr commented 11 months ago

Same here too =)

DoctorDiffusion commented 11 months ago

Also stuck here.

OracleToes commented 11 months ago

I sorta fixed it by adding safety_checker=None, to the nodes.py on this block:

        if self.pipe is None:
            self.pipe = LatentConsistencyModelPipeline.from_pretrained(
                pretrained_model_name_or_path="SimianLuo/LCM_Dreamshaper_v7",
                scheduler=self.scheduler,
                safety_checker=None,
            )

and it stopped giving me the error, but now it just generates black images

mp3pintyo commented 11 months ago

@OracleToes Thanks for the tip. That's how it works for me.

0xbitches commented 11 months ago

This is now fixed in https://github.com/0xbitches/ComfyUI-LCM/commit/697ec09ab524be4733d851eb0f470be107629fb6, closing for now.