cocktailpeanut / comfyui.pinokio

A 1-click launcher for https://github.com/comfyanonymous/ComfyUI
31 stars 8 forks source link

Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. #10

Closed hamster-poodle closed 10 months ago

hamster-poodle commented 10 months ago

Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. I recently encountered an issue while using the 'Impact Pack' custom node in the ComfyUI, which is part of the Pinokio service. The node failed to function as expected. Notably, I am using the portable version of ComfyUI, and when I attempted the same workflow, it worked correctly. This leads me to believe that the problem might be specific to Pinokio.

This issue arose after updating to version 1.0. I performed Factory Reset twice, and also carried out multiple reinstallations and updates. Eventually, I uninstalled and reinstalled Pinokio itself, but I still have an issue.

Error occurred when executing ImpactSimpleDetectorSEGS_for_AD:

Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at C:\actions-runner_work\vision\vision\pytorch\vision\torchvision\csrc\ops\cpu\nms_kernel.cpp:112 [kernel] QuantizedCPU: registered at C:\actions-runner_work\vision\vision\pytorch\vision\torchvision\csrc\ops\quantized\cpu\qnms_kernel.cpp:124 [kernel] BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback] Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:153 [backend fallback] FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:498 [backend fallback] Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:290 [backend fallback] Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback] Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback] Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:19 [backend fallback] ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback] ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback] AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback] AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback] AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback] AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback] AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback] AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback] AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback] AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback] AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback] Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:296 [backend fallback] AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:382 [backend fallback] AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:249 [backend fallback] FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:710 [backend fallback] FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:28 [backend fallback] Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback] VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback] FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:203 [backend fallback] PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:161 [backend fallback] FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:494 [backend fallback] PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:165 [backend fallback] PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:157 [backend fallback]

File "C:\Users\paras\pinokio\api\comfyui.git\app\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "C:\Users\paras\pinokio\api\comfyui.git\app\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "C:\Users\paras\pinokio\api\comfyui.git\app\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "C:\Users\paras\pinokio\api\comfyui.git\app\custom_nodes\ComfyUI-Impact-Pack\modules\impact\detectors.py", line 458, in doit return SimpleDetectorForAnimateDiff.detect(bbox_detector, image_frames, bbox_threshold, bbox_dilation, crop_factor, drop_size, File "C:\Users\paras\pinokio\api\comfyui.git\app\custom_nodes\ComfyUI-Impact-Pack\modules\impact\detectors.py", line 324, in detect segs = bbox_detector.detect(image, bbox_threshold, bbox_dilation, crop_factor, drop_size) File "C:\Users\paras\pinokio\api\comfyui.git\app\custom_nodes\ComfyUI-Impact-Pack\impact_subpack\impact\subcore.py", line 106, in detect detected_results = inference_bbox(self.bbox_model, core.tensor2pil(image), threshold) File "C:\Users\paras\pinokio\api\comfyui.git\app\custom_nodes\ComfyUI-Impact-Pack\impact_subpack\impact\subcore.py", line 33, in inference_bbox pred = model(image, conf=confidence, device=device) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\engine\model.py", line 101, in call return self.predict(source, stream, kwargs) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\engine\model.py", line 274, in predict return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\engine\predictor.py", line 204, in call return list(self.stream_inference(source, model, *args, *kwargs)) # merge list of Result into one File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\torch\utils_contextlib.py", line 35, in generator_context response = gen.send(None) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\engine\predictor.py", line 290, in stream_inference self.results = self.postprocess(preds, im, im0s) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\models\yolo\detect\predict.py", line 25, in postprocess preds = ops.non_max_suppression( File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\ultralytics\utils\ops.py", line 278, in non_max_suppression i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\torchvision\ops\boxes.py", line 41, in nms return torch.ops.torchvision.nms(boxes, scores, iou_threshold) File "C:\Users\paras\pinokio\api\comfyui.git\app\env\lib\site-packages\torch_ops.py", line 692, in call return self._op(args, **kwargs or {})

hamster-poodle commented 10 months ago

This issue has been fixed, although it wasn't very straightforward. I'm not a professional, so I just state the facts. The directory location depends on where you downloaded Pinokio.

Find Miniconda3 (64-bit) C:\Users\xxxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Miniconda3 (64-bit) Open Anaconda Powershell Prompt (miniconda) cd C:\Users\xxxx\pinokio\api\comfyui.git\app env\Scripts\activate pip uninstall xformers pip uninstall torch pip uninstall torchvision pip uninstall torchaudio

I get an error next step. pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu118

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\Users\xxxx\pinokio\api\comfyui.git\app\env\Lib\site-packages\torch_C.cp310-win_amd64.pyd' Check the permissions.

I delete the file "C:\Users\xxxx\pinokio\api\comfyui.git\app\env\Lib\site-packages\torch_C.cp310-win_amd64.pyd".

pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu118

This time I got this. Successfully installed torch-2.1.2+cu118 torchaudio-2.1.2+cu118 torchvision-0.16.2+cu118 xformers-0.0.23.post1+cu118

pip check No broken requirements found.

Thx a lot to Morpheus!