Since it seems that is very difficult do find a dlib version with CUDA support, I built the attached wheel.
The dlib version is the official one 19.24.99: https://github.com/davisking/dlib
The minimum CUDA requirement is: 11.4
The minimum CUDA capability is: 8.0 (see: compute capability 8)
Python version: 12.x
Platform: Windows 10/11
Python exception: cannot access local variable 'dlib' where it is not associated with a value
Traceback (most recent call last):
File "src\\cython\\vapoursynth.pyx", line 3365, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3366, in vapoursynth._vpy_evaluate
File "J:\tmp\tempPreviewVapoursynthFile14_49_39_867.vpy", line 42, in
clip = CodeFormer(clip=clip, upscale=1, detector=1, weight=1.000) # 640x352
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\__init__.py", line 103, in codeformer
FaceRestoreHelper(upscale, det_model=detection_model, use_parse=True, device=device) for _ in range(num_streams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\face_restoration_helper.py", line 113, in __init__
self.face_detector, self.shape_predictor_5 = self.init_dlib()
^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\face_restoration_helper.py", line 173, in init_dlib
face_detector = dlib.cnn_face_detection_model_v1(detection_path)
^^^^
UnboundLocalError: cannot access local variable 'dlib' where it is not associated with a value
if 'OFF' == 'ON':
add_lib_to_dll_path('')
add_lib_to_dll_path('CUDA_CUDART_LIBRARY-NOTFOUND')
does not help. (CUDA/v11.4 seem to be wrong too)
Note that with R68, Hybrid does no longer add any dlls to the PATH (torch_dependencies are no longer used/needed)
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Please remove "manually" any dlib version do you have in the library package and reinstall the provided wheel.
On my PC which is using R68 CodeFormer is able to use dlib and it is fast.
I checked that the 'Vapoursynth\Lib\site-packages'-folder does not contain any dlib folders. (https://pastebin.com/E9ZJDZKq)
I called
python -m pip list[/list] (https://pastebin.com/MeJPA2Kq)
I then called 'python -m pip install dlib-19.24.99-cp312-cp312-win_amd64.whl'
[code]
Processing f:\hybrid\64bit\vapoursynth\dlib-19.24.99-cp312-cp312-win_amd64.whl
Installing collected packages: dlib
Successfully installed dlib-19.24.99'
Sadly, I still get:
2024-06-01 15:33:04.544
Failed to evaluate the script:
Python exception: cannot access local variable 'dlib' where it is not associated with a value
Traceback (most recent call last):
File "src\\cython\\vapoursynth.pyx", line 3365, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3366, in vapoursynth._vpy_evaluate
File "J:\tmp\tempPreviewVapoursynthFile15_33_02_257.vpy", line 42, in
clip = CodeFormer(clip=clip, upscale=1, detector=1) # 640x352
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\__init__.py", line 103, in codeformer
FaceRestoreHelper(upscale, det_model=detection_model, use_parse=True, device=device) for _ in range(num_streams)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\face_restoration_helper.py", line 113, in __init__
self.face_detector, self.shape_predictor_5 = self.init_dlib()
^^^^^^^^^^^^^^^^
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\vscodeformer\face_restoration_helper.py", line 173, in init_dlib
face_detector = dlib.cnn_face_detection_model_v1(detection_path)
^^^^
UnboundLocalError: cannot access local variable 'dlib' where it is not associated with a value
If I remember previously it was necessary to include in the path the folder "torch_dependencies".
Probably on my PC is working because I have also the cuda 11.4 dll.
I have to check the thread on CodeFormer probably this issue was already covered in that post.
01.06.2024, 16:03 (This post was last modified: 01.06.2024, 16:05 by Selur.)
Loading torch dependencies was necessary since Vapoursynth prior R66 didn't properly install the Python environment.
All other filters work without having to use the torch_dependencies (which are not up-to-date with the versions used in the R68 environment).
cudart64_12.dll is present in "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\torchvision\"
cudnn64_8.dll is present in "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\torch\lib\"
python
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
>>> import dlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Hybrid\64bit\Vapoursynth\Lib\site-packages\dlib\__init__.py", line 20, in <module>
from _dlib_pybind11 import *
ImportError: DLL load failed while importing _dlib_pybind11: Das angegebene Modul wurde nicht gefunden.
python312_.pth contains:
Scripts
Lib\site-packages
python312.zip
.
here.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
But then this was needed for everything related to pytorch.
Collecting all torch related dlls and explicitly loading them should not be necessary anymore.
It deems strange that dlib is the only package that puts a pyd file in the sites-packages folder.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
01.06.2024, 16:22 (This post was last modified: 01.06.2024, 16:24 by Selur.)
Quote:Try to delete the file _dlib_pybind11.pyd is not necessary.
Deleting 'Vapoursynth\Lib\site-packages\_dlib_pybind11.cp312-win_amd64.pyd' doesn't help
Deleting "_dlib_pybind11.cp312-win_amd64.pyd\_dlib_pybind11.py" doesn't help either.
The normal package also installs dlib-bin, yours does not, could that be a problem?
('python -m pip install dlib-bin' would install the old 'dlib_bin-19.24.2.post1-cp312-cp312-win_amd64.whl' again)
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.