notAI-tech / NudeNet

Lightweight nudity detection
https://nudenet.notai.tech/
GNU Affero General Public License v3.0
1.76k stars 342 forks source link

How do you switch to onnxruntime-gpu? #111

Closed rmills closed 1 year ago

rmills commented 3 years ago

With onnxruntime being used in V2, I can't seem to force it to run on a GPU by default despite it being shown. There is another support ticket that says to uninstall onnxruntime and install onnxruntime-gpu however its unclear what that means. Uninstalling with PIP breaks nudenet regardless of the onnxruntime-gpu being installed. It will throw the exception "module 'onnxruntime' has no attribute 'InferenceSession'".

What are the steps to get onnxruntime-gpu running?

rmills commented 3 years ago

The docs really need to be updated. Going from v1 to v2 has a ton of steps and details there are just not listed anywhere. Getting V2 to work is convoluted and some of the documentation/notes are misleading. To get the GPU version working took hours. There was a comment about TF versions not mattering, this is not true. You can't use TF 2 and I only found that out after I uninstall everything and installed the latest, and that means you can only use python 3.7 and that creates other issues. The latest version of onnx did not work for me I had to go back to 1.8 and then sort out the correct cuda and cuDNN version to use just to find out the onnx files does not work thou I had no idea that was the case so I spent an hour thinking I had the wrong cuda/cuDNN installed until I saw a different support ticket. You have to fix it with another script in that solution and that one requires a different specific version of cuda that you have to go find.

At a minimum it would be helpful to know upfront what libs are required and their specific versions that were tested. Should also update the "detector_v2_default_checkpoint.onnx" that's hosted.

bedapudi6788 commented 3 years ago

The docs really need to be updated. Getting V2 to work is convoluted and some of the documentation/notes are misleading. To get the GPU version working took hours.

At a minimum it would be helpful to know upfront what libs are required and their specific versions that were tested. Should also update the "detector_v2_default_checkpoint.onnx" that's hosted.

Feel free to submit a pull request.

bedapudi6788 commented 1 year ago

Hi, v3 is released now and with lot less requirements. I am closing this issue for now. If gpu usage is needed, you can install nudenet first and then install onnxruntime-gpu after uninstalled onnxruntime