Rudrabha / Wav2Lip

This repository contains the codes of "A Lip Sync Expert Is All You Need for Speech to Lip Generation In the Wild", published at ACM Multimedia 2020. For HD commercial model, please try out Sync Labs
https://synclabs.so
9.74k stars 2.11k forks source link

Colab Notebook example cannot be run #578

Open isold23 opened 8 months ago

isold23 commented 8 months ago

Colab Notebook example cannot be run error message: Using cuda for inference. Reading video frames... Number of frames available for inference: 210 Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 280, in <module> main() File "/content/Wav2Lip/inference.py", line 225, in main mel = audio.melspectrogram(wav) File "/content/Wav2Lip/audio.py", line 47, in melspectrogram S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db File "/content/Wav2Lip/audio.py", line 95, in _linear_to_mel _mel_basis = _build_mel_basis() File "/content/Wav2Lip/audio.py", line 100, in _build_mel_basis return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given why && how to fix?

sahreen-haider commented 8 months ago

Colab Notebook example cannot be run error message: Using cuda for inference. Reading video frames... Number of frames available for inference: 210 Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 280, in <module> main() File "/content/Wav2Lip/inference.py", line 225, in main mel = audio.melspectrogram(wav) File "/content/Wav2Lip/audio.py", line 47, in melspectrogram S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db File "/content/Wav2Lip/audio.py", line 95, in _linear_to_mel _mel_basis = _build_mel_basis() File "/content/Wav2Lip/audio.py", line 100, in _build_mel_basis return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given why && how to fix?

lets debug the error: The above is a TypeError: indicating librosa.filter.mel() got 0 positional arguments are given, which indeed aren't needed. going to audio.py line 100, the arguments are there for a specific purpose like for sampling rate, The number of samples used in each block for the Fourier transform, The number of Mel filters to generate, The lowest frequency (in Hz) of the Mel filters, The highest frequency (in Hz) of the Mel filters. The below code does which is throwing the error looks something like the below. def _build_mel_basis(): assert hp.fmax <= hp.sample_rate // 2 return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, fmin=hp.fmin, fmax=hp.fmax) But as far as I can make a sense of it the code is pretty legit and shouldn't be raising an error, Now navigating through several files and looking through a bunch of code, what I can guess is the format expected here is 'wav' for audio. So please look for the audio format that your are using, if the audio is not 'wav' then it needs to be changed.

isold23 commented 8 months ago

Thank you for your reply. The problem was solved by lowering the version of librosa, but a new problem appeared. The installation of the lower version of numba failed, and the following interface incompatibility problem occurred with the higher version of numba. how should I solve this? Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 3, in <module> import scipy, cv2, os, sys, argparse, audio File "/content/Wav2Lip/audio.py", line 1, in <module> import librosa File "/usr/local/lib/python3.10/dist-packages/librosa/__init__.py", line 13, in <module> from . import core File "/usr/local/lib/python3.10/dist-packages/librosa/core/__init__.py", line 114, in <module> from .time_frequency import * # pylint: disable=wildcard-import File "/usr/local/lib/python3.10/dist-packages/librosa/core/time_frequency.py", line 10, in <module> from ..util.exceptions import ParameterError File "/usr/local/lib/python3.10/dist-packages/librosa/util/__init__.py", line 73, in <module> from . import decorators File "/usr/local/lib/python3.10/dist-packages/librosa/util/decorators.py", line 9, in <module> from numba.decorators import jit as optional_jit ModuleNotFoundError: No module named 'numba.decorators'

sahreen-haider commented 8 months ago

Thank you for your reply. The problem was solved by lowering the version of librosa, but a new problem appeared. The installation of the lower version of numba failed, and the following interface incompatibility problem occurred with the higher version of numba. how should I solve this? Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 3, in <module> import scipy, cv2, os, sys, argparse, audio File "/content/Wav2Lip/audio.py", line 1, in <module> import librosa File "/usr/local/lib/python3.10/dist-packages/librosa/__init__.py", line 13, in <module> from . import core File "/usr/local/lib/python3.10/dist-packages/librosa/core/__init__.py", line 114, in <module> from .time_frequency import * # pylint: disable=wildcard-import File "/usr/local/lib/python3.10/dist-packages/librosa/core/time_frequency.py", line 10, in <module> from ..util.exceptions import ParameterError File "/usr/local/lib/python3.10/dist-packages/librosa/util/__init__.py", line 73, in <module> from . import decorators File "/usr/local/lib/python3.10/dist-packages/librosa/util/decorators.py", line 9, in <module> from numba.decorators import jit as optional_jit ModuleNotFoundError: No module named 'numba.decorators'

I think these error's are rising due to incompatibility issues.

- So trying previous builds of python might help, rather than using python 3.10.

isold23 commented 8 months ago

If you lower the python version to 3.8, pip cannot be installed, and the example still cannot be run. colab cannot install python3.6.

sahreen-haider commented 7 months ago

If you lower the python version to 3.8, pip cannot be installed, and the example still cannot be run. colab cannot install python3.6.

is there anyway you can try to run it on your local machine.

davidkundrats commented 7 months ago

Colab Notebook example cannot be run error message: Using cuda for inference. Reading video frames... Number of frames available for inference: 210 Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 280, in <module> main() File "/content/Wav2Lip/inference.py", line 225, in main mel = audio.melspectrogram(wav) File "/content/Wav2Lip/audio.py", line 47, in melspectrogram S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db File "/content/Wav2Lip/audio.py", line 95, in _linear_to_mel _mel_basis = _build_mel_basis() File "/content/Wav2Lip/audio.py", line 100, in _build_mel_basis return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given why && how to fix?

Which colab are you running?

isold23 commented 7 months ago

Colab Notebook example cannot be run error message: Using cuda for inference. Reading video frames... Number of frames available for inference: 210 Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 280, in <module> main() File "/content/Wav2Lip/inference.py", line 225, in main mel = audio.melspectrogram(wav) File "/content/Wav2Lip/audio.py", line 47, in melspectrogram S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db File "/content/Wav2Lip/audio.py", line 95, in _linear_to_mel _mel_basis = _build_mel_basis() File "/content/Wav2Lip/audio.py", line 100, in _build_mel_basis return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels, TypeError: mel() takes 0 positional arguments but 2 positional arguments (and 3 keyword-only arguments) were given why && how to fix?

Which colab are you running?

https://colab.research.google.com/drive/1tZpDWXz49W6wDcTprANRGLo2D_EbD5J8?usp=sharing

Leungsiuyin commented 5 months ago

After reading librosa Doc https://librosa.org/doc/latest/generated/librosa.filters.mel.html We can change the code in audio.py line 100 to : return librosa.filters.mel(sr=hp.sample_rate, n_fft=hp.n_fft, n_mels=hp.num_mels, fmin=hp.fmin, fmax=hp.fmax)

Arslan-Mehmood1 commented 5 months ago

To all those facing : No module named 'numba.decorators'

set librosa version to 0.9.0. and numba = 0.58.1

Colab - Python 3.10.12 Date - Jan 18 2024