zhongpei / Comfyui_image2prompt

image to prompt by vikhyatk/moondream1
GNU General Public License v3.0
243 stars 14 forks source link

这个是什么错误呢? #15

Closed 0tao closed 4 months ago

0tao commented 4 months ago

模型都自动下载了运行后出现这个 Error occurred when executing LoadImage2TextModel:

Make sure _init_weights is implemented for

File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\image2text.py", line 29, in get_model File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\moondream_model.py", line 1177, in init File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\moondream_model.py", line 1196, in load_model File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\moondream_model.py", line 1084, in init File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\moondream_model.py", line 1012, in init File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\moondream_model.py", line 954, in init File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\transformers\modeling_utils.py", line 1043, in post_init self.init_weights() File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\transformers\modeling_utils.py", line 1507, in init_weights self.apply(self._init_weights) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\torch\nn\modules\module.py", line 897, in apply module.apply(fn) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\torch\nn\modules\module.py", line 897, in apply module.apply(fn) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\torch\nn\modules\module.py", line 898, in apply fn(self) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\python\lib\site-packages\transformers\modeling_utils.py", line 1170, in _init_weights raise NotImplementedError(f"Make sure _init_weights is implemented for {self.class}") -------------------------------另一个json也报错

Error occurred when executing LoadImage2TextModel:

local variable 'model' referenced before assignment

File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\image2text.py", line 27, in get_model return (InternlmVLModle(device=device,low_memory=low_memory),) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\internlm_model.py", line 28, in init self.model_path, self.model, self.tokenizer = self.load_model(device=device, dtype=dtype) File "D:\ComfyUI-aki\ComfyUI-aki-v1.1\custom_nodes\Comfyui_image2prompt-main\internlm_model.py", line 57, in load_model model = model.cpu().float().eval()

咋回事呢

zhongpei commented 4 months ago

https://github.com/zhongpei/Comfyui_image2prompt/issues/8

Updating the transformer might fix it.

Open the menu in ComfyUI Manager, click on Install PIP packages, enter pip install transformers==4.37.2, and click OK. After that, try restarting.

gonzalu commented 4 months ago

After following the instructions, I am now no longer getting errors and the node works :D

Thank you

yotraxxx commented 3 months ago

8

Updating the transformer might fix it.

Open the menu in ComfyUI Manager, click on Install PIP packages, enter pip install transformers==4.37.2, and click OK. After that, try restarting.

Issue solved here too, thanks to your explanations :) Thank you !