pythongosssss / ComfyUI-WD14-Tagger

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

CUDA and cuDNN Loading Error with ONNX Runtime #56

Closed gabriel-filincowsky closed 1 month ago

gabriel-filincowsky commented 1 month ago

Description:

I am encountering the following error every time I execute WD14Tagger:

Error occurred when executing WD14Tagger|pysssss:

D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:743 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\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 "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\wd14tagger.py", line 200, in tag
tags.append(wait_for_async(lambda: tag(image, model, threshold, character_threshold, exclude_tags, replace_underscore, trailing_comma)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\pysssss.py", line 214, in wait_for_async
loop.run_until_complete(run_async())
File "asyncio\base_events.py", line 653, in run_until_complete
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\pysssss.py", line 204, in run_async
r = await async_fn()
^^^^^^^^^^^^^^^^
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger\wd14tagger.py", line 58, in tag
model = InferenceSession(name, providers=defaults["ortProviders"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 430, in __init__
raise fallback_error from e
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 425, in __init__
self._create_inference_session(self._fallback_providers, None)
File "G:\_SD\Swarm\StableSwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 463, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)

Steps Taken to Resolve:

  1. Uninstalled and reinstalled the custom node via the ComfyUI Manager.
  2. Ran pip uninstall onnxruntime and onnxruntime_gpu.
  3. Reinstalled ONNX Runtime using pip install onnxruntime onnxruntime-gpu.
  4. Upgraded the inference library using pip install --upgrade inference.

Current Versions:

Despite these steps, the issue persists.

Could you please provide guidance on resolving this error? I have ensured that both CUDA and cuDNN are in the PATH and that my GPU is supported.

Thank you for your assistance.

vtn54 commented 1 month ago

go to ComfyUI_windows_portable\python_embeded, type CMD in addressbar, hit enter: paste python.exe -s -m pip uninstall onnxruntime type yes(Y) PASTE python.exe -s -m pip uninstall onnxruntime-gpu type yes(Y) run comfyui go to Manager - Install missing custom nodes - click 'Try to fix it' button Restart

nocnestudio commented 1 month ago

Thank You so much. Now It's working with cuda 12.4

gabriel-filincowsky commented 1 month ago

Thank you. It is working.

I tried something similar before, but not running CMD from _ComfyUI_windows_portable\pythonembeded.

nocnestudio commented 1 month ago

You have to downgrade from 1.18.0 to 1.16.3. Is working !!!!!!!!!!!!!!!!!! python -m pip install onnxruntime-gpu==1.16.3