pythongosssss / ComfyUI-WD14-Tagger

A ComfyUI extension allowing for the interrogation of booru tags from images.
MIT License
436 stars 51 forks source link

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first #18

Closed QueenPuxxi closed 3 months ago

QueenPuxxi commented 6 months ago

When I use this node, I encounter an error:

Error occurred when executing WD14Tagger|pysssss:

can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

File "C:\Blender_ComfyUI\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Blender_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:\Blender_ComfyUI\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Blender_ComfyUI\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\wd14tagger.py", line 163, in tag tensor = np.array(tensor, dtype=np.uint8) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Blender_ComfyUI\python_embeded\Lib\site-packages\torch_tensor.py", line 1032, in array return self.numpy().astype(dtype, copy=False) ^^^^^^^^^^^^

image

pythongosssss commented 5 months ago

What is the source node for the image you are sending to the tagger?

QueenPuxxi commented 5 months ago

It's "Any Switch (rgthree)". Here is my workflows: https://drive.google.com/file/d/1hSkzh6-yHuUS4EITvE71wjUPRnhos_Yx/view?usp=drive_link

pythongosssss commented 5 months ago

Would you be able to try recreating the issue without these custom nodes in a simpler workflow please as there are a lot of nodes there I dont have