152334H / DL-Art-School

TorToiSe fine-tuning with DLAS
GNU Affero General Public License v3.0
205 stars 86 forks source link

Got error trying to test the fine-tuned model #74

Closed itachiluan closed 1 year ago

itachiluan commented 1 year ago

Hi, thanks very much for providing this amazing repo!

I have tried a little bit of fine-tuning the model, and ran the tortoise_tts.py script using the command below

./scripts/tortoise_tts.py --preset fast --ar_checkpoint $model_path -o test.wav --text "Hello, how are you?"

I got the error below:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/ps/Documents/voice-test/voice/./tortoise-tts-fast/scripts/tortoise_tts.py:240 in <module>      │
│                                                                                                  │
│   237 │   #     app = import_module("app")                                                       │
│   238 │   #     sys.exit(app.main())                                                             │
│   239 │                                                                                          │
│ ❱ 240 │   from tortoise.inference import (                                                       │
│   241 │   │   check_pydub,                                                                       │
│   242 │   │   get_all_voices,                                                                    │
│   243 │   │   get_seed,                                                                          │
│                                                                                                  │
│ /home/ps/Documents/voice-test/voice/tortoise-tts-fast/tortoise/inference.py:167 in <module>          │
│                                                                                                  │
│   164                                                                                            │
│   165 from voicefixer import VoiceFixer                                                          │
│   166                                                                                            │
│ ❱ 167 vfixer = VoiceFixer()                                                                      │
│   168                                                                                            │
│   169                                                                                            │
│   170 def save_gen_with_voicefix(g, fpath, squeeze=True, voicefixer=True):                       │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/voicefixer/base.py:13 in       │
│ __init__                                                                                         │
│                                                                                                  │
│    10 class VoiceFixer(nn.Module):                                                               │
│    11 │   def __init__(self):                                                                    │
│    12 │   │   super(VoiceFixer, self).__init__()                                                 │
│ ❱  13 │   │   self._model = voicefixer_fe(channels=2, sample_rate=44100)                         │
│    14 │   │   # print(os.path.join(os.path.expanduser('~'), ".cache/voicefixer/analysis_module   │
│    15 │   │   self.analysis_module_ckpt = os.path.join(                                          │
│    16 │   │   │   │   │   os.path.expanduser("~"),                                               │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/voicefixer/restorer/model.py:1 │
│ 80 in __init__                                                                                   │
│                                                                                                  │
│   177 │   │   # self.am = AudioMetrics()                                                         │
│   178 │   │   # self.im = ImgMetrics()                                                           │
│   179 │   │                                                                                      │
│ ❱ 180 │   │   self.vocoder = Vocoder(sample_rate=44100)                                          │
│   181 │   │                                                                                      │
│   182 │   │   self.valid = None                                                                  │
│   183 │   │   self.fake = None                                                                   │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/voicefixer/vocoder/base.py:19  │
│ in __init__                                                                                      │
│                                                                                                  │
│   16 │   │   │   raise RuntimeError("Error 1: The checkpoint for synthesis module / vocoder (    │
│   17 │   │   │   │   │   │   │   │   By default the checkpoint should be download automatical    │
│   18 │   │   │   │   │   │   │   │   But don't worry! Alternatively you can download it direc    │
│ ❱ 19 │   │   self._load_pretrain(Config.ckpt)                                                    │
│   20 │   │   self.weight_torch = Config.get_mel_weight_torch(percent=1.0)[                       │
│   21 │   │   │   None, None, None, ...                                                           │
│   22 │   │   ]                                                                                   │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/voicefixer/vocoder/base.py:26  │
│ in _load_pretrain                                                                                │
│                                                                                                  │
│   23 │                                                                                           │
│   24 │   def _load_pretrain(self, pth):                                                          │
│   25 │   │   self.model = Generator(Config.cin_channels)                                         │
│ ❱ 26 │   │   checkpoint = load_checkpoint(pth, torch.device("cpu"))                              │
│   27 │   │   load_try(checkpoint["generator"], self.model)                                       │
│   28 │   │   self.model.eval()                                                                   │
│   29 │   │   self.model.remove_weight_norm()                                                     │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/voicefixer/vocoder/model/util. │
│ py:111 in load_checkpoint                                                                        │
│                                                                                                  │
│   108                                                                                            │
│   109                                                                                            │
│   110 def load_checkpoint(checkpoint_path, device):                                              │
│ ❱ 111 │   checkpoint = torch.load(checkpoint_path, map_location=device)                          │
│   112 │   return checkpoint                                                                      │
│   113                                                                                            │
│   114                                                                                            │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/torch/serialization.py:777 in  │
│ load                                                                                             │
│                                                                                                  │
│    774 │   │   │   # If we want to actually tail call to torch.jit.load, we need to              │
│    775 │   │   │   # reset back to the original position.                                        │
│    776 │   │   │   orig_position = opened_file.tell()                                            │
│ ❱  777 │   │   │   with _open_zipfile_reader(opened_file) as opened_zipfile:                     │
│    778 │   │   │   │   if _is_torchscript_zip(opened_zipfile):                                   │
│    779 │   │   │   │   │   warnings.warn("'torch.load' received a zip file that looks like a To  │
│    780 │   │   │   │   │   │   │   │     " dispatching to 'torch.jit.load' (call 'torch.jit.loa  │
│                                                                                                  │
│ /home/ps/Documents/voice-test/envs/voice/lib/python3.10/site-packages/torch/serialization.py:282 in  │
│ __init__                                                                                         │
│                                                                                                  │
│    279                                                                                           │
│    280 class _open_zipfile_reader(_opener):                                                      │
│    281 │   def __init__(self, name_or_buffer) -> None:                                           │
│ ❱  282 │   │   super(_open_zipfile_reader, self).__init__(torch._C.PyTorchFileReader(name_or_bu  │
│    283                                                                                           │
│    284                                                                                           │
│    285 class _open_zipfile_writer_file(_opener):                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Just wondering what was the issue? When I tried the first time I saw the script tried to download some models but I was running tortoise for some time already and the .cache/tortoise/models folder had the models, so I cancelled the running and when I execute the command again, it didn't run on the downloading bit, so maybe because the file was already created but not complete? If that's the case, just wondering where did the script download the additional models? Thanks very much for looking into my issue.

itachiluan commented 1 year ago

Nevermind, found the path, it was in .cache/voicefixer.