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
10.17k stars 2.19k forks source link

mel() error #550

Open EricKong1985 opened 12 months ago

EricKong1985 commented 12 months ago

when I run the project in the colab,

i will show the error below:

Using cuda for inference. Reading video frames... Number of frames available for inference: 223 Traceback (most recent call last): File "/content/Wav2Lip/inference.py", line 280, in 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

HassanMuhammadSannaullah commented 12 months ago

Don't know if it will helpful for you but I have created a repository that fixes the running for inference using the pretrained model. here is the link https://github.com/HassanMuhammadSannaullah/Wav2lip-Fix-For-Inference

xugaoxiang commented 11 months ago

pip install librosa == 0.8.0

er1cw00 commented 11 months ago

when using librosa>=0.10.0, you should fix “_build_mel_basis()” in audio.py


def _build_mel_basis():
    assert hp.fmax <= hp.sample_rate // 2
    return librosa.filters.mel(sr=hp.sample_rate, n_fft=hp.n_fft, n_mels=hp.num_mels,
                               fmin=hp.fmin, fmax=hp.fmax)
vimgaa commented 8 months ago

when using librosa>=0.10.0, you should fix “_build_mel_basis()” in audio.py

def _build_mel_basis():
    assert hp.fmax <= hp.sample_rate // 2
    return librosa.filters.mel(sr=hp.sample_rate, n_fft=hp.n_fft, n_mels=hp.num_mels,
                               fmin=hp.fmin, fmax=hp.fmax)

Thanks for sharing, this change works for me

Aml-Hassan-Abd-El-hamid commented 7 months ago

when using librosa>=0.10.0, you should fix “_build_mel_basis()” in audio.py

def _build_mel_basis():
    assert hp.fmax <= hp.sample_rate // 2
    return librosa.filters.mel(sr=hp.sample_rate, n_fft=hp.n_fft, n_mels=hp.num_mels,
                               fmin=hp.fmin, fmax=hp.fmax)

You're a lifesaver! Thank you very much :)