Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when training VITS model for vctk dataset #5708

Open
coding-phoenix-12 opened this issue Mar 19, 2024 · 3 comments
Open

Error when training VITS model for vctk dataset #5708

coding-phoenix-12 opened this issue Mar 19, 2024 · 3 comments
Labels
Bug bug should be fixed

Comments

@coding-phoenix-12
Copy link
Contributor

coding-phoenix-12 commented Mar 19, 2024

I am trying to train the VITS TTS for multi-speaker setup using xvector using the vctk recipe. I am using the instructions provided in https://github.com/espnet/espnet/blob/master/egs2/TEMPLATE/tts1/README.md#vits-training. I get the following error while training

line 116, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (39x192 and 512x256)

Basic environments:

  • OS information: Linux 5.15.0-97-generic
  • python version: 3.9.18 (main, Aug 25 2023, 13:20:04) [GCC 9.4.0]
  • espnet version: espnet 202402
  • Git hash:d0047402e830a3c53e8b590064af4bf70415fb3b
    • Commit date: Mon Mar 4 22:19:02 2024 +0000
  • pytorch version [e.g. pytorch 1.4.0]

Environments from torch.utils.collect_env:

PyTorch version: 2.2.1+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: version 3.27.2
Libc version: glibc-2.31

Python version: 3.9.18 (main, Aug 25 2023, 13:20:04)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-97-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce RTX 3090

Nvidia driver version: 510.108.03
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.5
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.4
/usr/local/cuda-11.4/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.4
/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.4

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Byte Order:                         Little Endian
Address sizes:                      46 bits physical, 48 bits virtual
CPU(s):                             64
On-line CPU(s) list:                0-63
Thread(s) per core:                 2
Core(s) per socket:                 16
Socket(s):                          2
NUMA node(s):                       2
Vendor ID:                          GenuineIntel
CPU family:                         6
Model:                              85
Model name:                         Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz
Stepping:                           7
CPU MHz:                            2900.000
CPU max MHz:                        3900.0000
CPU min MHz:                        1200.0000
BogoMIPS:                           5800.00
L1d cache:                          1 MiB
L1i cache:                          1 MiB
L2 cache:                           32 MiB
L3 cache:                           44 MiB
NUMA node0 CPU(s):                  0-15,32-47
NUMA node1 CPU(s):                  16-31,48-63
Vulnerability Gather data sampling: Mitigation; Microcode  
Vulnerability Itlb multihit:        KVM: Mitigation: VMX unsupported
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:             Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Mitigation; TSX disabled
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] clip-anytorch==2.5.2
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.23.5
[pip3] pytorch-lightning==2.1.3
[pip3] pytorch-metric-learning==2.4.1
[pip3] pytorch-ranger==0.1.1
[pip3] torch==2.2.1+cu118
[pip3] torch-audiomentations==0.11.0
[pip3] torch-complex==0.4.3
[pip3] torch-optimizer==0.3.0
[pip3] torch-pitch-shift==1.2.4
[pip3] torchaudio==2.2.1+cu118
[pip3] torchdiffeq==0.2.3
[pip3] torchmetrics==1.3.0.post0
[pip3] torchsde==0.2.5
[pip3] torchvision==0.17.1+cu118
[pip3] triton==2.2.0
[conda] Could not collect



**Task information:**
 - Task: TTS
 - Recipe: vctk
 - ESPnet2

**To Reproduce**
Steps to reproduce the behavior:
1. move to a recipe directory, e.g., `cd egs2/vctk/tts1/`
2. Run the following 
   ./run.sh \
    --stage 2 \
    --use_spk_embed true \
    --ngpu 4 \
    --fs 22050 \
    --n_fft 1024 \
    --n_shift 256 \
    --win_length null \
    --dumpdir dump/22k \
    --expdir exp/22k \
    --tts_task gan_tts \
    --feats_extract linear_spectrogram \
    --feats_normalize none \
    --train_config ./conf/tuning/train_xvector_vits.yaml \
    --inference_config ./conf/tuning/decode_vits.yaml \
    --inference_model latest.pth

** Error logs**
File "/home1/espnet/espnet2/gan_tts/vits/vits.py", line 514, in _forward_discrminator
    outs = self.generator(
  File "/home/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home1/espnet/espnet2/gan_tts/vits/generator.py", line 321, in forward
    g_ = self.spemb_proj(F.normalize(spembs)).unsqueeze(-1)
  File "/home/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/envs/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/envs/venv/lib/python3.9/site-packages/torch/nn/modules/linear.py", line 116, in forward
    return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (39x192 and 512x256)


@coding-phoenix-12 coding-phoenix-12 added the Bug bug should be fixed label Mar 19, 2024
@sw005320
Copy link
Contributor

Thanks for the report.
@kan-bayashi, can you check it?

@kan-bayashi
Copy link
Member

kan-bayashi commented Mar 21, 2024

It seems that default speaker embedding is changed (I designed the config for kaldi-xvector).

use_spk_embed=false # Whether to use speaker embedding.
spk_embed_tag=espnet_spk # The additional tag of speaker embedding folder, use "xvector" for compatibility.
spk_embed_gpu_inference=false # Whether to use gpu to inference speaker embedding.
spk_embed_tool=espnet # Toolkit for extracting x-vector (speechbrain, rawnet, espnet, kaldi).
spk_embed_model=espnet/voxcelebs12_rawnet3 # For only espnet, speechbrain, or rawnet.

There are two method:

  1. Modify config to match the current default speaker embedding
  2. Using kaldi-xvector

Maybe 1 is easier. Just change the following line from 512 to 192.

@ftshijt
Copy link
Collaborator

ftshijt commented Mar 21, 2024

Hi, echo @kan-bayashi 's point

  • if you are training the model from scratch, you may directly change the config as his suggestion
  • If you want to mimic exact behavior of previous Kaldi-xvector, you can set spk_embed_tool to kaldi
  • If you are dealing with the pre-trained model, you can set spk_embed_tool to kaldi and spk_embed_tag to xvector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug bug should be fixed
Projects
None yet
Development

No branches or pull requests

4 participants