yl4579 / StyleTTS

Official Implementation of StyleTTS
MIT License
387 stars 62 forks source link

Fixing librosa compatibility issue and UTF-8 issue #34

Closed Artyom17 closed 1 year ago

Artyom17 commented 1 year ago

When running train_first.py with librosa 0.10 I got error about resample call:

Original Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\torch\utils\data\_utils\worker.py", line 308, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Python310\lib\site-packages\torch\utils\data\_utils\fetch.py", line 51, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Python310\lib\site-packages\torch\utils\data\_utils\fetch.py", line 51, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "E:\Work\StyleTTS\meldataset.py", line 101, in __getitem__
    wave, text_tensor, speaker_id = self._load_tensor(data)
  File "E:\Work\StyleTTS\meldataset.py", line 119, in _load_tensor
    wave = librosa.resample(wave, sr, 24000)
TypeError: resample() takes 1 positional argument but 3 were given

Fixing it with the line 'wave = librosa.resample(wave, orig_sr=sr, target_sr=24000)'

Also fixing an issue of reading the UTF-8 file without specifying the encoding which led to an error about unknown character on Windows.