OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.49k stars 2.16k forks source link

'CacheManager' object has no attribute 'cachedir' #4

Closed chrisbward closed 1 year ago

chrisbward commented 1 year ago

Hitting this error when running an inference;

(.venv) (base) ➜  SadTalker git:(main) ✗ python inference.py --driver_audio japanese.wav --source_image art_1.png --result_dir .
Traceback (most recent call last):
  File "inference.py", line 9, in <module>
    from generate_batch import get_data
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/generate_batch.py", line 5, in <module>
    import librosa    
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/__init__.py", line 12, in <module>
    from . import core
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/core/__init__.py", line 102, in <module>
    from .time_frequency import *  # pylint: disable=wildcard-import
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/core/time_frequency.py", line 10, in <module>
    from ..util.exceptions import ParameterError
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/util/__init__.py", line 67, in <module>
    from .utils import *  # pylint: disable=wildcard-import
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/util/utils.py", line 111, in <module>
    def valid_audio(y, mono=True):
  File "/media/user/home/04_MachineLearning/10_talkingheads/SadTalker/.venv/lib/python3.8/site-packages/librosa/cache.py", line 49, in wrapper
    if self.cachedir is not None and self.level >= level:
AttributeError: 'CacheManager' object has no attribute 'cachedir'
kt3000 commented 1 year ago

You can try this. I solved the problem in this way. pip install librosa==0.7.2 pip install numba==0.48.0 pip install llvmlite==0.31.0

JimmyTime commented 1 year ago

I had this same problem. The install of librosa worked for me. The numba and llvmite were already satisfied in my case. Afterwards I was able to "advance" :) to this problem: python inference.py --driven_audio japanese.wav --source_image art_1.png --result_dir . checkpoints\epoch_20.pth Traceback (most recent call last): File "inference.py", line 98, in <module> main(args) File "inference.py", line 48, in main preprocess_model = CropAndExtract(path_of_lm_croper, path_of_net_recon_model, dir_of_BFM_fitting, device) File "C:\Talky\preprocess.py", line 46, in __init__ self.kp_extractor = KeypointExtractor() File "C:\Talky\face3d\extract_kp_videos.py", line 16, in __init__ self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\face_alignment\api.py", line 77, in __init__ self.face_detector = face_detector_module.FaceDetector(device=device, verbose=verbose, **face_detector_kwargs) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\face_alignment\detection\sfd\sfd_detector.py", line 31, in __init__ self.face_detector.to(device) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\torch\nn\modules\module.py", line 989, in to return self._apply(convert) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\torch\nn\modules\module.py", line 641, in _apply module._apply(fn) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\torch\nn\modules\module.py", line 664, in _apply param_applied = fn(param) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\torch\nn\modules\module.py", line 987, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) File "C:\Users\jimes\anaconda3\envs\Talky\lib\site-packages\torch\cuda\__init__.py", line 221, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

chrisbward commented 1 year ago

You can try this. I solved the problem in this way. pip install librosa==0.7.2 pip install numba==0.48.0 pip install llvmlite==0.31.0

This fixed this issue.

@JimmyTime I would open a new ticket for that

bbecausereasonss commented 1 year ago

I had this same problem. The install of librosa worked for me. The numba and llvmite were already satisfied in my case. Afterwards I was able to "advance" :) to this problem: python in... line 221, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

See you didn't make a new thread so I'll respond to it here. I had this issue and fixed it by:

-I downloaded the latest CUDA + CUDNN for my system and set the environment path variables for Cuda + Cuda Path properly. -Force uninstalled what it was using ( pip3 uninstall torch torchvision torchaudio ) and went to the pytorch website and installed the latest: ( pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 )

Can you explain to me like I'm 5? lol. I have Cuda/CUDDN torth and it works with all other repoos. I'm confused. I don't want this to mess anything up.

bbecausereasonss commented 1 year ago

I had this same problem. The install of librosa worked for me. The numba and llvmite were already satisfied in my case. Afterwards I was able to "advance" :) to this problem: python in... line 221, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

See you didn't make a new thread so I'll respond to it here. I had this issue and fixed it by: -I downloaded the latest CUDA + CUDNN for my system and set the environment path variables for Cuda + Cuda Path properly. -Force uninstalled what it was using ( pip3 uninstall torch torchvision torchaudio ) and went to the pytorch website and installed the latest: ( pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117 )

Can you explain to me like I'm 5? lol. I have Cuda/CUDDN torth and it works with all other repoos. I'm confused. I don't want this to mess anything up.

To be honest with you - I'm kind of new and ran around like a headless chicken on this too. I heavily leaned on ChatGPT to guide me through the installation (anytime you have an issue you just tell ChatGPT that you have a python error and give the error code and it will guide you through what you have to do next)

I used Anaconda Navigator > Made an environment with Python 3.8 > navigated to Sadtalker and activated. Once you activate then you should type in "pip show torch" mine says the following:

Name: torch Version: 1.13.1+cu117 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: https://pytorch.org/ etc

I assume if yours doesn't say the torch version + cu117 or similar then that means you need to do what I said in my previous comment.--- again I heavily leaned on ChatGPT to find success (but keep in mind it offers outdated links since its stuck on 2021 data which you need to manually update)

Thanks.. lol now I just get a different error

"(sadtalker) C:\Users\chlyw\Desktop\SadTalker>python inference.py --driven_audio Carlin.wav --source_image Carlin.png --/ --camera_yaw -20 30 10 Traceback (most recent call last): File "inference.py", line 6, in from preprocess import CropAndExtract File "C:\Users\chlyw\Desktop\SadTalker\preprocess.py", line 4, in from PIL import Image File "C:\Users\chlyw.conda\envs\sadtalker\lib\site-packages\PIL\Image.py", line 103, in from . import _imaging as core ImportError: DLL load failed while importing _imaging: The specified module could not be found."

InitialMoon commented 7 months ago

You can try this. I solved the problem in this way. pip install librosa==0.7.2 pip install numba==0.48.0 pip install llvmlite==0.31.0

thank you, it's very useful

I solve a similar problem when I use librosa, here is my porblem

(MindSpore) [ma-user Tacotron2]$python --versionPython 3.7.10
(MindSpore) [ma-user Tacotron2]$python generate_hdf5.py --data_path ../LJSpeech-1.1Traceback (most recent call last):
  File "generate_hdf5.py", line 23, in <module>
    import librosa
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/__init__.py", line 12, in <module>
    from . import core
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/core/__init__.py", line 102, in <module>
    from .time_frequency import *  # pylint: disable=wildcard-import
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/core/time_frequency.py", line 10, in <module>
    from ..util.exceptions import ParameterError
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/util/__init__.py", line 67, in <module>
    from .utils import *  # pylint: disable=wildcard-import
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/util/utils.py", line 111, in <module>
    def valid_audio(y, mono=True):
  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/librosa/cache.py", line 49, in wrapper
    if self.cachedir is not None and self.level >= level:
AttributeError: 'CacheManager' object has no attribute 'cachedir'

so I think they may the same problem, thank for finding out the libs which is depending on. my original librosa is 0.6.0, which has this bug, if you have the same problem, I think your solution is valiad