RVC-Boss / GPT-SoVITS

1 min voice data can also be used to train a good TTS model! (few shot voice cloning)
MIT License
35.21k stars 4.02k forks source link

开启SoVITS训练时报错:RuntimeError: The size of tensor a (350) must match the size of tensor b (524) at non-singleton dimension 2 #744

Open SRbone opened 8 months ago

SRbone commented 8 months ago

开启SoVITS训练时报错:

D:\python\lib\site-packages\torch\functional.py:650: UserWarning: stft with return_complex=False is deprecated. In a future pytorch release, stft will return complex tensors for all inputs, and return_complex=False will raise an error.
Note: you can still call torch.view_as_real on the complex output to recover the old return format. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\SpectralOps.cpp:868.)
  return _VF.stft(input, n_fft, hop_length, win_length, window,  # type: ignore[attr-defined]
D:\python\lib\site-packages\torch\functional.py:650: UserWarning: ComplexHalf support is experimental and many operators don't support it yet. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\EmptyTensor.cpp:32.)
  return _VF.stft(input, n_fft, hop_length, win_length, window,  # type: ignore[attr-defined]
0it [00:07, ?it/s]
0it [00:07, ?it/s]

Traceback (most recent call last):
  File "./s2_train.py", line 600, in <module>
    main()
  File "./s2_train.py", line 56, in main
    mp.spawn(
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 246, in spawn
    return start_processes(fn, args, nprocs, join, daemon, start_method="spawn")
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 202, in start_processes
    while not context.join():
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 163, in join
    raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 1 terminated with the following error:
Traceback (most recent call last):
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 74, in _wrap
    fn(i, *args)
  File "D:\GPT_SoVITS\s2_train.py", line 268, in run
    train_and_evaluate(
  File "D:\GPT_SoVITS\s2_train.py", line 385, in train_and_evaluate
    loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl
  File "D:\GPT_SoVITS\module\losses.py", line 57, in kl_loss
    kl = logs_p - logs_q - 0.5
RuntimeError: The size of tensor a (350) must match the size of tensor b (524) at non-singleton dimension 2
nickshui commented 6 months ago

开启SoVITS训练时报错:

D:\python\lib\site-packages\torch\functional.py:650: UserWarning: stft with return_complex=False is deprecated. In a future pytorch release, stft will return complex tensors for all inputs, and return_complex=False will raise an error.
Note: you can still call torch.view_as_real on the complex output to recover the old return format. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\SpectralOps.cpp:868.)
  return _VF.stft(input, n_fft, hop_length, win_length, window,  # type: ignore[attr-defined]
D:\python\lib\site-packages\torch\functional.py:650: UserWarning: ComplexHalf support is experimental and many operators don't support it yet. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\EmptyTensor.cpp:32.)
  return _VF.stft(input, n_fft, hop_length, win_length, window,  # type: ignore[attr-defined]
0it [00:07, ?it/s]
0it [00:07, ?it/s]

Traceback (most recent call last):
  File "./s2_train.py", line 600, in <module>
    main()
  File "./s2_train.py", line 56, in main
    mp.spawn(
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 246, in spawn
    return start_processes(fn, args, nprocs, join, daemon, start_method="spawn")
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 202, in start_processes
    while not context.join():
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 163, in join
    raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 1 terminated with the following error:
Traceback (most recent call last):
  File "D:\python\lib\site-packages\torch\multiprocessing\spawn.py", line 74, in _wrap
    fn(i, *args)
  File "D:\GPT_SoVITS\s2_train.py", line 268, in run
    train_and_evaluate(
  File "D:\GPT_SoVITS\s2_train.py", line 385, in train_and_evaluate
    loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl
  File "D:\GPT_SoVITS\module\losses.py", line 57, in kl_loss
    kl = logs_p - logs_q - 0.5
RuntimeError: The size of tensor a (350) must match the size of tensor b (524) at non-singleton dimension 2

我也在摸索,下午出现类似的错误:RuntimeError: The size of tensor a (869) must match the size of tensor b (512) at non-singleton dimension 1

可能问题是你切割的音频时长太长,你的显存不够处理了。我的显存是6G,基本超过17秒的音频都出错 解决方法是,将threshold的值调小一点,会让分割的音频比较短,后者你手动调整,使得音频时长不要超过20秒。 image

EmbraceDaytime commented 1 month ago

return _VF. stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined] RuntimeError: cuFFT doesn't support signals of half type with compute capability less than SM_53, but the device containing input half tensor only has SM_50

这个怎么解决?