1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.03k stars 1.34k forks source link

Error with CUDA option for detecting landmarks. Version 1.3.3 #248

Closed rakadambi closed 3 years ago

rakadambi commented 3 years ago

I am doing landmarks using SFD and CUDA. With CUDA I am getting some kind of cuda_init error. It is working fine with CPU option.

My GPU seems fine. Here is the result of nvidia-smi

Tue Jan 19 13:39:19 2021
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.102.04 Driver Version: 450.102.04 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 GeForce GTX 166... Off | 00000000:01:00.0 Off | N/A | | N/A 36C P8 2W / N/A | 179MiB / 5944MiB | 3% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 1480 G /usr/lib/xorg/Xorg 150MiB | | 0 N/A N/A 1637 G /usr/bin/gnome-shell 26MiB | +-----------------------------------------------------------------------------+

In my requirements, I have these

torch==1.5.0 torchfile==0.1.0 torchvision==0.6.0

The error I am seeing is as follows:

THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=47 error=999 : unknown error Traceback (most recent call last): File "replace.py", line 9, in fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, face_detector='sfd', device = 'cuda') File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/face_alignment/api.py", line 75, in init self.face_detector = face_detector_module.FaceDetector(device=device, verbose=verbose) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/face_alignment/detection/sfd/sfd_detector.py", line 30, in init self.face_detector.to(device) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 443, in to return self._apply(convert) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 203, in _apply module._apply(fn) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 225, in _apply param_applied = fn(param) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 441, in convert return t.to(device, dtype if t.is_floating_point() else None, non_blocking) File "/home/aditya/Python_code_learning/dev/kython_env/lib/python3.7/site-packages/torch/cuda/init.py", line 153, in _lazy_init torch._C._cuda_init() RuntimeError: cuda runtime error (999) : unknown error at /pytorch/aten/src/THC/THCGeneral.cpp:47

What am I doing wrong?

1adrianb commented 3 years ago

Hi @rakadambi,

I don't think this is something specific to the library itself but more general with your cuda&pytorch setup. Please see [1] and [2]

rakadambi commented 3 years ago

Thank you very much! Those links were helpful in fixing the issue.