Please try to reinstall the provided wheel.
You can try to rename or delete the file _dlib_pybind11.py.
Then try to do an "import dlib" in python to see the problem is solved.
Quote:Then try to do an "import dlib" in python to see the problem is solved.
F:\Hybrid\64bit\Vapoursynth>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.
=> not fixed
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
try this version of dlib for python 3.12, built using CUDA 12.1 and cuDNN 8.9.7
Dan
P.S.
Remove any version before install the the attached wheel.
I changed the version number, to have more room to release other builds.
After the install clear the cache: dlib\__pycache__\__init__.cpython-312.pyc
* created 'Vapoursynth'-folder
* downloaded 'Windows embeddable package (64-bit)' from https://www.python.org/downloads/release/python-3126/
* extracted it into the 'Vapoursynth'-folder
* downloaded 'VapourSynth64-Portable-R70' from https://github.com/vapoursynth/vapoursynth/releases
* extracted it into the 'Vapoursynth'-folder
* finished Vapoursynth portable installation:
* adjusted `python312._pth` by adding:
```
Scripts
Lib\site-packages
```
* installed pip:
* download get-pip.py from https://bootstrap.pypa.io/get-pip.py into the 'Vapoursynth'-folder
* `python get-pip.py`
* `python -m pip install wheel\VapourSynth-70-cp312-cp312-win_amd64.whl`
* install vsrife dependencies, by calling:
* `python -m pip install -U packaging setuptools wheel`
* `python -m pip install -U torch torchvision torch_tensorrt --index-url https://download.pytorch.org/whl/nightly/cu124 --extra-index-url https://pypi.nvidia.com` (without '--pre')
* installed CodeFormer by calling:
* `python -m pip install dlib-19.24.93-cp312-cp312-win_amd64` (from https://forum.selur.net/attachment.php?aid=2532)
* `python -m pip install vscodeformer-1.0.2-py3-none-any.whl` (from https://forum.selur.net/attachment.php?aid=2552)
* `python -m vscodeformer`
Using dlib fails:
2024-09-29 07:34:56.868
F:\workspace\Hybrid\debug\64bit\Vapoursynth\Lib\site-packages\vscodeformer\__init__.py:98: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
module.load_state_dict(torch.load(model_path, map_location="cpu")["params_ema"])
F:\workspace\Hybrid\debug\64bit\Vapoursynth\Lib\site-packages\vscodeformer\__init__.py:98: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
module.load_state_dict(torch.load(model_path, map_location="cpu")["params_ema"])
2024-09-29 07:34:57.135
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 3387, in vapoursynth._vpy_evaluate
File "src\\cython\\vapoursynth.pyx", line 3388, in vapoursynth._vpy_evaluate
File "J:\tmp\tempPreviewVapoursynthFile07_34_54_512.vpy", line 43, in
clip = CodeFormer(clip=clip, upscale=1, detector=1) # 640x352
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\workspace\Hybrid\debug\64bit\Vapoursynth\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "F:\workspace\Hybrid\debug\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:\workspace\Hybrid\debug\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:\workspace\Hybrid\debug\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
Listing the installed packages using 'python -m pip list':
I think that is the same problem observed with Pytorch-Correlation-extension package.
The last pytorch is not compatible. Try to use this version (at least to see if the problem is related to CUDA).
There is a reason why there a few distributions of dblib with GPU enabled.
The code is very old, was developed using a very old python version (still using egg containers) and adapt it to the last python and GPU version is very difficult.