SayaSS / vits-finetuning

Fine-Tuning your VITS model using a pre-trained model
MIT License
551 stars 86 forks source link

TypeError: mel() takes 0 positional arguments but 5 were given #12

Closed dwninfinity closed 1 year ago

dwninfinity commented 1 year ago

I'm following the instructions to get started, so to get the gist of it i'm using the provided lists and wavs while just adapting the paths to my system's.

After running the command python train_ms.py -c configs/config.json -m checkpoints, I encountered a TypeError when calling the mel() function in the spec_to_mel_torch() function in the mel_processing.py file, any help appreciated.

Traceback:

INFO:torch.distributed.distributed_c10d:Added key: store_based_barrier_key:1 to store for rank: 0
INFO:torch.distributed.distributed_c10d:Rank 0: Completed store-based barrier for key:store_based_barrier_key:1 with 1 nodes.
./vits-finetune/checkpoints/G_0.pth
INFO:checkpoints:Loaded checkpoint './vits-finetune/checkpoints/G_0.pth' (iteration 0)
./vits-finetune/checkpoints/D_0.pth
INFO:checkpoints:Loaded checkpoint './vits-finetune/checkpoints/D_0.pth' (iteration 0)
  0%|                                                                                                                                                                                      | 0/8 [00:52<?, ?it/s]
Traceback (most recent call last):
  File "train_ms.py", line 306, in <module>
    main()
  File "train_ms.py", line 56, in main
    mp.spawn(run, nprocs=n_gpus, args=(n_gpus, hps,))
  File "/mnt/d/AI/vits-finetuning/venvwsl/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 240, in spawn
    return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
  File "/mnt/d/AI/vits-finetuning/venvwsl/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 198, in start_processes
    while not context.join():
  File "/mnt/d/AI/vits-finetuning/venvwsl/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 160, in join
    raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 0 terminated with the following error:
Traceback (most recent call last):
  File "/mnt/d/AI/vits-finetuning/venvwsl/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap
    fn(i, *args)
  File "/mnt/d/AI/vits-finetuning/train_ms.py", line 124, in run
    train_and_evaluate(rank, epoch, hps, [net_g, net_d], [optim_g, optim_d], [scheduler_g, scheduler_d], scaler, [train_loader, eval_loader], logger, [writer, writer_eval])
  File "/mnt/d/AI/vits-finetuning/train_ms.py", line 160, in train_and_evaluate
    hps.data.mel_fmax)
  File "/mnt/d/AI/vits-finetuning/mel_processing.py", line 78, in spec_to_mel_torch
    mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax)
TypeError: mel() takes 0 positional arguments but 5 were given

Additional Information:

My pip freeze:

For version comparison

absl-py==1.4.0 appdirs==1.4.4 audioread==3.0.0 cachetools==5.3.0 certifi==2022.12.7 cffi==1.15.1 charset-normalizer==3.0.1 cycler==0.11.0 Cython==0.29.33 decorator==5.1.1 fonttools==4.38.0 google-auth==2.16.1 google-auth-oauthlib==0.4.6 grpcio==1.51.3 idna==3.4 importlib-metadata==6.0.0 joblib==1.2.0 kiwisolver==1.4.4 lazy_loader==0.1 librosa==0.10.0 llvmlite==0.39.1 Markdown==3.4.1 MarkupSafe==2.1.2 matplotlib==3.5.3 msgpack==1.0.4 numba==0.56.4 numpy==1.21.6 oauthlib==3.2.2 packaging==23.0 Pillow==9.4.0 pooch==1.6.0 protobuf==3.9.2 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 pyopenjtalk==0.3.0 pyparsing==3.0.9 python-dateutil==2.8.2 requests==2.28.2 requests-oauthlib==1.3.1 rsa==4.9 scikit-learn==1.0.2 scipy==1.7.3 six==1.16.0 soundfile==0.12.1 soxr==0.3.3 tensorboard==2.11.2 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 threadpoolctl==3.1.0 torch==1.13.1+cu116 torchaudio==0.13.1+cu116 torchvision==0.14.1+cu116 tqdm==4.64.1 typing_extensions==4.5.0 Unidecode==1.3.6 urllib3==1.26.14 Werkzeug==2.2.3 zipp==3.15.0

softmurata commented 1 year ago

You should downgrade librosa. I worked well at librosa==0.8.0 so you should do pip install librosa==0.8.0 and maybe work fine.

dwninfinity commented 1 year ago

You should downgrade librosa. I worked well at librosa==0.8.0 so you should do pip install librosa==0.8.0 and maybe work fine.

Thank you very much, this solved the issue.

agilebean commented 1 year ago

You should downgrade librosa. I worked well at librosa==0.8.0 so you should do pip install librosa==0.8.0 and maybe work fine.

I confirm it will work also for the newer version librosa==0.9.1. This will give a warning that version 0.10 will throw an error.

yannqi commented 7 months ago

Chnage the code as below:

mel_basis = librosa_mel_fn(
           sr=sampling_rate, n_fft=filter_length, n_mels=n_mel_channels, fmin=mel_fmin, fmax=mel_fmax
        )