Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: only one element tensors can be converted to Python scalars #8

Closed
wencxxxxxx opened this issue Apr 6, 2024 · 15 comments
Closed

Comments

@wencxxxxxx
Copy link

屏幕截图 2024-04-07 020450

What is the reason for this, thank you for your help

@dafeng012
Copy link

我找到了解决办法,我是在本地python-embed移动环境里面安装这个库python.exe -m pip install face-recognition

@dafeng012
Copy link

我找到了解决办法,我是在本地python-embed移动环境里面安装这个库python.exe -m pip install face-recognition

我单独使用时没问题,但是放入其他工作流中使用,仍然有问题

@dafeng012
Copy link

我找到了解决办法,我是在本地python-embed移动环境里面安装这个库python.exe -m pip install face-recognition

我单独使用时没问题,但是放入其他工作流中使用,仍然有问题

Uploading Snipaste_2024-04-12_11-35-37.png…

@rkuzmin
Copy link

rkuzmin commented Apr 30, 2024

Got the same problem. dlib and inisightface are installed
image

@vootox
Copy link

vootox commented May 27, 2024

When I set 'filter_best = 1' error
But with filter_best = 0 no error
That's all I know

@lhovav
Copy link

lhovav commented May 28, 2024

I have this issute too..."only one element tensors can be converted to Python scalars"

@cubiq
Copy link
Owner

cubiq commented May 28, 2024

I need the full backtrace

@lhovav
Copy link

lhovav commented May 28, 2024

ohh sorry, I didn't want to jump into someone's else ticket..

FETCH DATA from: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json
got prompt
Failed to validate prompt for output 30:

  • (prompt):
    • Required input is missing: images
  • PreviewImage 30:
    • Required input is missing: images
      Output will be ignored
      [rgthree] Using rgthree's optimized recursive execution.
      [rgthree] First run patching recursive_output_delete_if_changed and recursive_will_execute.
      [rgthree] Note: If execution seems broken due to forward ComfyUI changes, you can disable the optimization from rgthree settings in ComfyUI.
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\det_10g.onnx detection [1, 3, '?', '?'] 127.5 128.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\w600k_r50.onnx recognition ['None', 3, 112, 112] 127.5 127.5
      set det-size: (640, 640)
      model_type EPS
      Using xformers attention in VAE
      Using xformers attention in VAE
      loaded straight to GPU
      Requested to load BaseModel
      Loading 1 new model
      INFO: Clip Vision model loaded from D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\clip_vision\CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors
      INFO: IPAdapter model loaded from D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\ipadapter\ip-adapter-faceid-plusv2_sd15.bin
      INFO: LoRA model loaded from D:\programs\Python310\Projects\A1111\stable-diffusion-webui\models/Lora\ip-adapter-faceid-plusv2_sd15_lora.safetensors
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\det_10g.onnx detection [1, 3, '?', '?'] 127.5 128.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0
      Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
      find model: D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\insightface\models\buffalo_l\w600k_r50.onnx recognition ['None', 3, 112, 112] 127.5 127.5
      set det-size: (640, 640)
      INFO: InsightFace model loaded with CPU provider
      INFO: the IPAdapter reference image is not a square, CLIPImageProcessor will resize and crop it at the center. If the main focus of the picture is not in the middle the result might not be what you are expecting.
      INFO: InsightFace detection resolution lowered to (576, 576).
      Requested to load CLIPVisionModelProjection
      Loading 1 new model
      INFO: IPAdapter model loaded from D:\programs\SD\ComfyUI_windows_portable\ComfyUI\models\ipadapter\ip-adapter-plus-face_sd15.bin
      Requested to load SD1ClipModel
      Loading 1 new model
      Requested to load BaseModel
      Loading 1 new model
      100%|##################################################################################| 12/12 [00:01<00:00, 6.73it/s]
      Using xformers attention in VAE
      Using xformers attention in VAE
      Requested to load AutoencoderKL
      Loading 1 new model
      Face Analysis: value: 0.3327401876449585, normalized: 0.48932380536023307
      !!! Exception during processing!!! only one element tensors can be converted to Python scalars
      Traceback (most recent call last):
      File "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
      output_data, output_ui = get_output_data(obj, input_data_all)
      File "D:\programs\SD\ComfyUI_windows_portable\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 "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
      results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
      File "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_FaceAnalysis\faceanalysis.py", line 452, in analize
      out = np.array(out)
      ValueError: only one element tensors can be converted to Python scalars

Prompt executed in 10.78 seconds

I updated the custom node, comfyui, installed dlib (insightface works well), can't chose dlib though under the face analysis models

Thanks.

@cubiq cubiq closed this as completed in 52f126c May 28, 2024
@cubiq
Copy link
Owner

cubiq commented May 28, 2024

please check the latest version. I believe this is caused by an older numpy version, but the new code should work anyway

@lhovav
Copy link

lhovav commented May 28, 2024

Thanks for the quick reply Matteo

I have the latest version I believe: numpy 1.26.4 (I updated it earlier today) - But now after reloading everything I get this message:

Error occurred when executing FaceEmbedDistance:

can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint64, uint32, uint16, uint8, and bool.

File "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\programs\SD\ComfyUI_windows_portable\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 "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\programs\SD\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_FaceAnalysis\faceanalysis.py", line 455, in analize
out = torch.from_numpy(out[idx][:filter_best])

Thanks.

@cubiq
Copy link
Owner

cubiq commented May 28, 2024

you need to update this extension as well

@lhovav
Copy link

lhovav commented May 28, 2024

Wow I pulled something new...But I swear I did like 2 hours ago a pull...did you update it recently or am i tripping? I see you had 20 minutes ago an update, was it related to this issue? - ohh and its working for me - you need to win a noble price Matteo

@cubiq
Copy link
Owner

cubiq commented May 28, 2024

yes I just pushed an update. glad it finally works

@lhovav
Copy link

lhovav commented May 28, 2024

Awesome job Matteo - Thank you very much..<3

@vootox
Copy link

vootox commented May 28, 2024

Also working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants