deepfakes / faceswap-playground

User dedicated repo for the faceswap project
306 stars 194 forks source link

WARNING No GPU detected. Switching to CPU mode. #240

Closed mrl998 closed 5 years ago

mrl998 commented 5 years ago

The program can use GPU when training model, but when i try to extract face, the program will show this warning and can only use CPU. I have cuda 9.0 and cdnn 7.4.2, then i chose enable CUDA and use AVX instruction when setup. I also have try to build Dlib by myself, but it doesn't fix this problem.

Here is the log when i try to extract: 01/23/2019 04:48:00 INFO Log level set to: INFO 01/23/2019 04:48:03 INFO Output Directory: D:\deeptest\f\ggg1 01/23/2019 04:48:03 INFO Input Directory: D:\deeptest\p\ggg1 01/23/2019 04:48:03 INFO Loading Detect from Mtcnn plugin... 01/23/2019 04:48:03 INFO Loading Align from Dlib plugin... 01/23/2019 04:48:03 WARNING No GPU detected. Switching to CPU mode

Here is the log when setup: INFO The tool provides tips for installation and installs required python packages INFO Setup in Windows 10 INFO Installed Python: 3.5.6 64bit INFO Upgrading pip... INFO Installed pip: 19.0 Enable Docker? [y/N] n INFO Docker Disabled Enable CUDA? [Y/n] y INFO CUDA Enabled INFO CUDA version: 9.0 INFO cuDNN version: 7.4.2 INFO Checking System Dependencies... INFO CMake version: 3.13.3 INFO Visual Studio 2015 version: 14.0 INFO Visual Studio C++ version: v14.0.24215.01

I will be very grateful for your reply 💃 💃

bryanlyon commented 5 years ago

What GPUs do you have on your system?

If it's not an Nvidia card then you wont be able to use GPU support as CUDA is Nvidia specific.

mrl998 commented 5 years ago

What GPUs do you have on your system?

If it's not an Nvidia card then you wont be able to use GPU support as CUDA is Nvidia specific.

@bryanlyon GeForce GTX 1060 6G, I can use GPU in training model. Only extracting has some problem.

torzdf commented 5 years ago

@mrl998 Could you open up your faceswap virtual environment and give me the output of this command:

python -c "import pynvml ; pynvml.nvmlInit() ; print('Devices: {}'.format(pynvml.nvmlDeviceGetCount())) ; print('Driver: {}'.format(pynvml.nvmlSystemGetDriverVersion().decode('utf-8')))"
mrl998 commented 5 years ago

@torzdf (faceswap) C:\Users\MRL\faceswap>python -c "import pynvml ; pynvml.nvmlInit() ; print('Devices: {}'.format(pynvml.nvmlDeviceGetCount())) ; print('Driver: {}'.format(pynvml.nvmlSystemGetDriverVersion().decode('utf-8')))" File "<string>", line 1 import pynvml ; pynvml.nvmlInit() ; print('Devices: {}'.format(pynvml.nvmlDeviceGetCount())) ; print('Driver: {}'.format(pynvml.nvmlSystemGetDriverVersion().decode('utf-8'))) ^ SyntaxError: invalid syntax

Then I removed the last few symbols:

(faceswap) C:\Users\MRL\faceswap>python -c "import pynvml ; pynvml.nvmlInit() ; print('Devices: {}'.format(pynvml.nvmlDeviceGetCount())) ; print('Driver: {}'.format(pynvml.nvmlSystemGetDriverVersion().decode('utf-8')))" Traceback (most recent call last): File "", line 1, in File "C:\Users\MRL\AppData\Roaming\Python\Python35\site-packages\pynvml.py", line 608, in nvmlInit _LoadNvmlLibrary() File "C:\Users\MRL\AppData\Roaming\Python\Python35\site-packages\pynvml.py", line 646, in _LoadNvmlLibrary _nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND) File "C:\Users\MRL\AppData\Roaming\Python\Python35\site-packages\pynvml.py", line 310, in _nvmlCheckReturn raise NVMLError(ret) pynvml.NVMLError_LibraryNotFound: NVML Shared Library Not Found

torzdf commented 5 years ago

Basically faceswap has not found your graphics card. Make sure your driver is installed properly.

Extract taps into NVML to get graphics card stats. It can't find the install on your pc.

mrl998 commented 5 years ago

@torzdf I installed the latest version of the graphics card driver and did not solve the problem. Then I checked the system files and found that the NVSMI folder was missing from my C:\Program Files\NVIDIA Corporation. I copied this folder from somewhere else and then run the code you gave above. The following is the output:

(faceswap) C:\Users\MRL>python -c "import pynvml ; pynvml.nvmlInit() ; print('Devices: {}'.format(pynvml.nvmlDeviceGetCount())) ; print('Driver: {}'.format(pynvml.nvmlSystemGetDriverVersion().decode('utf-8')))" Devices: 1 Driver: 417.71

Then run extract and find that the warning disappears, but the extraction speed is similar to the original. I opened the task manager and found that the GPU usage is very low, the CPU usage is about 90%. It still seems to work with the CPU?