RVC-Project / Retrieval-based-Voice-Conversion-WebUI

Easily train a good VC model with voice data <= 10 mins!
MIT License
24.44k stars 3.6k forks source link

IndexError: list index out of range - train_nsf_sim_cache_sid_load_pretrain.py, line 184 #1111

Closed junaid3d closed 1 year ago

junaid3d commented 1 year ago

When I click Train Model, I get the following errors: (I've tried using f0 pretrained model and the non f0 too)

all-feature-done

2023-08-28 09:51:02 | INFO | httpx | HTTP Request: POST http://localhost:7897/api/predict "HTTP/1.1 200 OK"
2023-08-28 09:51:02 | INFO | httpx | HTTP Request: POST http://localhost:7897/api/predict "HTTP/1.1 200 OK"
2023-08-28 09:51:02 | INFO | httpx | HTTP Request: POST http://localhost:7897/reset "HTTP/1.1 200 OK"
write filelist done
use gpus: 0
"python.exe" train_nsf_sim_cache_sid_load_pretrain.py -e "mun" -sr 40k -f0 0 -bs 6 -g 0 -te 100 -se 5 -pg D:\AI\svc\rvc\git\rvc\pretrained\f0G40k.pth -pd D:\AI\svc\rvc\git\rvc\pretrained\f0D40k.pth -l 0 -c 0 -sw 0 -v v2
INFO:mun:{'train': {'log_interval': 200, 'seed': 1234, 'epochs': 20000, 'learning_rate': 0.0001, 'betas': [0.8, 0.99], 'eps': 1e-09, 'batch_size': 6, 'fp16_run': False, 'lr_decay': 0.999875, 'segment_size': 12800, 'init_lr_ratio': 1, 'warmup_epochs': 0, 'c_mel': 45, 'c_kl': 1.0}, 'data': {'max_wav_value': 32768.0, 'sampling_rate': 40000, 'filter_length': 2048, 'hop_length': 400, 'win_length': 2048, 'n_mel_channels': 125, 'mel_fmin': 0.0, 'mel_fmax': None, 'training_files': './logs\\mun/filelist.txt'}, 'model': {'inter_channels': 192, 'hidden_channels': 192, 'filter_channels': 768, 'n_heads': 2, 'n_layers': 6, 'kernel_size': 3, 'p_dropout': 0, 'resblock': '1', 'resblock_kernel_sizes': [3, 7, 11], 'resblock_dilation_sizes': [[1, 3, 5], [1, 3, 5], [1, 3, 5]], 'upsample_rates': [10, 10, 2, 2], 'upsample_initial_channel': 512, 'upsample_kernel_sizes': [16, 16, 4, 4], 'use_spectral_norm': False, 'gin_channels': 256, 'spk_embed_dim': 109}, 'model_dir': './logs\\mun', 'experiment_dir': './logs\\mun', 'save_every_epoch': 5, 'name': 'mun', 'total_epoch': 100, 'pretrainG': 'D:\\AI\\svc\\rvc\\git\\rvc\\pretrained\\f0G40k.pth', 'pretrainD': 'D:\\AI\\svc\\rvc\\git\\rvc\\pretrained\\f0D40k.pth', 'version': 'v2', 'gpus': '0', 'sample_rate': '40k', 'if_f0': 0, 'if_latest': 0, 'save_every_weights': '0', 'if_cache_data_in_gpu': 0}
D:\AI\svc\rvc\lib\site-packages\torch\nn\utils\weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
  warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
gin_channels: 256 self.spk_embed_dim: 109
INFO:mun:loaded pretrained D:\AI\svc\rvc\git\rvc\pretrained\f0G40k.pth
Process Process-1:
Traceback (most recent call last):
  File "D:\AI\svc\rvc\git\rvc\train_nsf_sim_cache_sid_load_pretrain.py", line 184, in run
    utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"), net_d, optim_d
  File "D:\AI\svc\rvc\git\rvc\lib\train\utils.py", line 207, in latest_checkpoint_path
    x = f_list[-1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\AI\Python\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "D:\AI\Python\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "D:\AI\svc\rvc\git\rvc\train_nsf_sim_cache_sid_load_pretrain.py", line 203, in run
    net_g.module.load_state_dict(
  File "D:\AI\svc\rvc\lib\site-packages\torch\nn\modules\module.py", line 2152, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SynthesizerTrnMs768NSFsid_nono:
        Unexpected key(s) in state_dict: "enc_p.emb_pitch.weight", "dec.m_source.l_linear.weight", "dec.m_source.l_linear.bias", "dec.noise_convs.0.weight", "dec.noise_convs.0.bias", "dec.noise_convs.1.weight", "dec.noise_convs.1.bias", "dec.noise_convs.2.weight", "dec.noise_convs.2.bias", "dec.noise_convs.3.weight", "dec.noise_convs.3.bias".
        size mismatch for enc_p.emb_phone.weight: copying a param with shape torch.Size([192, 256]) from checkpoint, the shape in current model is torch.Size([192, 768]).
2023-08-28 09:51:18 | INFO | httpx | HTTP Request: POST http://localhost:7897/api/predict "HTTP/1.1 200 OK"
2023-08-28 09:51:18 | INFO | httpx | HTTP Request: POST http://localhost:7897/reset "HTTP/1.1 200 OK"
junaid3d commented 1 year ago

This is what ChatGPT diagnoses:

This log describes the execution and errors encountered while running a Python script for training a neural speech synthesis model. Here's a step-by-step explanation of the log:

The script is invoked using the command python.exe train_nsf_sim_cache_sid_load_pretrain.py along with various command-line arguments.

The arguments include settings for the experiment (-e "mun"), the sampling rate (-sr 40k), the frequency (-f0 0), batch size (-bs 6), GPU index (-g 0), number of training epochs (-te 20), save interval (-se 5), paths to pre-trained generator (-pg pretrained/G40k.pth) and discriminator (-pd pretrained/D40k.pth) models, and other configuration parameters.

The log provides information about the configuration settings for the training process, including hyperparameters, data specifications, and model architecture.

The script generates a warning about the deprecation of torch.nn.utils.weight_norm in favor of torch.nn.utils.parametrizations.weight_norm.

The warning mentions gin_channels and spk_embed_dim, which are specific model parameters and their values.

The log indicates that the pre-trained generator model (pretrained/G40k.pth) has been successfully loaded.

An error occurs during the training process while trying to load the latest checkpoint for the discriminator (net_d). The error message indicates that the code is attempting to access the last element of a list, but the list is empty (list index out of range).

Another error occurs while handling the previous exception. This error is related to loading the state dictionary of the generator model (net_g). The error message states that there's a size mismatch for a specific parameter (enc_p.emb_phone.weight) between the checkpoint and the current model.

Subsequent lines show HTTP requests and responses related to an API used in the script.

The log mentions that certain pre-trained model files (pretrained_v2/G40k.pth and pretrained_v2/D40k.pth) do not exist and will not be used.

In summary, the log provides information about the configuration, loading of pre-trained models, and errors encountered during the training process, specifically related to loading checkpoint files and a size mismatch in model parameters.

459737087 commented 3 months ago

Hi! Did you solve it ?