cubiq / ComfyUI_InstantID

Apache License 2.0
949 stars 51 forks source link

Error occurred when executing ApplyInstantID #130

Closed vuongtrannguyenkhoi closed 2 months ago

vuongtrannguyenkhoi commented 2 months ago

I got error like this. Please help me how to solve this problem. Error occurred when executing ApplyInstantID:

pic should be PIL Image or ndarray. Got

File "ComfyUI/execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "ComfyUI/execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "ComfyUI/execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "ComfyUI/custom_nodes/ComfyUI_InstantID/InstantID.py", line 283, in apply_instantid face_kps = extractFeatures(insightface, image_kps if image_kps is not None else image[0].unsqueeze(0), extract_kps=True) File "ComfyUI/custom_nodes/ComfyUI_InstantID/InstantID.py", line 180, in extractFeatures out = torch.stack(T.ToTensor()(out), dim=0).permute([0,2,3,1]) File "ComfyUI/venv/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 135, in call return F.to_tensor(pic) File "ComfyUI/venv/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 137, in to_tensor raise TypeError(f"pic should be PIL Image or ndarray. Got {type(pic)}")

cubiq commented 2 months ago

your python version seems to be pretty old, use at least 3.10

vuongtrannguyenkhoi commented 2 months ago

your python version seems to be pretty old, use at least 3.10

Thanks for the quick response, it seems I'm using an old version of torch, it works when updated to torch version > 2.0