152334H / tortoise-tts-fast

Fast TorToiSe inference (5x or your money back!)
GNU Affero General Public License v3.0
755 stars 176 forks source link

RuntimeError: Error(s) in loading state_dict for UnifiedVoice #102

Open josuebatista opened 1 year ago

josuebatista commented 1 year ago

Crash while running notebook https://github.com/152334H/tortoise-tts-fast/blob/main/tortoise_tts.ipynb

tts = TextToSpeech()

Crashes with error:

`Downloading (…)lve/main/config.json: 100% 2.11k/2.11k [00:00<00:00, 95.5kB/s] Downloading pytorch_model.bin: 100% 1.26G/1.26G [00:15<00:00, 88.0MB/s] Downloading (…)rocessor_config.json: 100% 159/159 [00:00<00:00, 8.26kB/s] Downloading (…)olve/main/vocab.json: 100% 1.61k/1.61k [00:00<00:00, 116kB/s] Downloading (…)okenizer_config.json: 100% 181/181 [00:00<00:00, 12.0kB/s] Downloading (…)cial_tokens_map.json: 100% 85.0/85.0 [00:00<00:00, 4.39kB/s] Downloading autoregressive.pth from https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/autoregressive.pth...

Done. ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in <cell line: 14>:14 │ │ │ │ /content/tortoise-tts-fast/tortoise/api.py:271 in init │ │ │ │ 268 │ │ │ │ .eval() │ │ 269 │ │ │ ) │ │ 270 │ │ │ ar_path = ar_checkpoint or get_model_path("autoregressive.pth", models_dir) │ │ ❱ 271 │ │ │ self.autoregressive.load_state_dict(torch.load(ar_path)) │ │ 272 │ │ │ self.autoregressive.post_init_gpt2_config(kv_cache) │ │ 273 │ │ │ │ │ 274 │ │ │ diff_path = diff_checkpoint or get_model_path( │ │ │ │ /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:1671 in load_state_dict │ │ │ │ 1668 │ │ │ │ │ │ ', '.join('"{}"'.format(k) for k in missing_keys))) │ │ 1669 │ │ │ │ 1670 │ │ if len(error_msgs) > 0: │ │ ❱ 1671 │ │ │ raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( │ │ 1672 │ │ │ │ │ │ │ self.class.name, "\n\t".join(error_msgs))) │ │ 1673 │ │ return _IncompatibleKeys(missing_keys, unexpected_keys) │ │ 1674 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ RuntimeError: Error(s) in loading state_dict for UnifiedVoice: Unexpected key(s) in state_dict: "gpt.h.0.attn.bias", "gpt.h.0.attn.masked_bias", "gpt.h.1.attn.bias", "gpt.h.1.attn.masked_bias", "gpt.h.2.attn.bias", "gpt.h.2.attn.masked_bias", "gpt.h.3.attn.bias", "gpt.h.3.attn.masked_bias", "gpt.h.4.attn.bias", "gpt.h.4.attn.masked_bias", "gpt.h.5.attn.bias", "gpt.h.5.attn.masked_bias", "gpt.h.6.attn.bias", "gpt.h.6.attn.masked_bias", "gpt.h.7.attn.bias", "gpt.h.7.attn.masked_bias", "gpt.h.8.attn.bias", "gpt.h.8.attn.masked_bias", "gpt.h.9.attn.bias", "gpt.h.9.attn.masked_bias", "gpt.h.10.attn.bias", "gpt.h.10.attn.masked_bias", "gpt.h.11.attn.bias", "gpt.h.11.attn.masked_bias", "gpt.h.12.attn.bias", "gpt.h.12.attn.masked_bias", "gpt.h.13.attn.bias", "gpt.h.13.attn.masked_bias", "gpt.h.14.attn.bias", "gpt.h.14.attn.masked_bias", "gpt.h.15.attn.bias", "gpt.h.15.attn.masked_bias", "gpt.h.16.attn.bias", "gpt.h.16.attn.masked_bias", "gpt.h.17.attn.bias", "gpt.h.17.attn.masked_bias", "gpt.h.18.attn.bias", "gpt.h.18.attn.masked_bias", "gpt.h.19.attn.bias", "gpt.h.19.attn.masked_bias", "gpt.h.20.attn.bias", "gpt.h.20.attn.masked_bias", "gpt.h.21.attn.bias", "gpt.h.21.attn.masked_bias", "gpt.h.22.attn.bias", "gpt.h.22.attn.masked_bias", "gpt.h.23.attn.bias", "gpt.h.23.attn.masked_bias", "gpt.h.24.attn.bias", "gpt.h.24.attn.masked_bias", "gpt.h.25.attn.bias", "gpt.h.25.attn.masked_bias", "gpt.h.26.attn.bias", "gpt.h.26.attn.masked_bias", "gpt.h.27.attn.bias", "gpt.h.27.attn.masked_bias", "gpt.h.28.attn.bias", "gpt.h.28.attn.masked_bias", "gpt.h.29.attn.bias", "gpt.h.29.attn.masked_bias".`

dipaloka commented 1 year ago

i have this error too

mehulsuresh commented 1 year ago

you guys can try downgrading transformers pip install transformers==4.19.0

artkrylov commented 1 year ago

@mehulsuresh Thank you very much. It works!

josuebatista commented 1 year ago

@mehulsuresh Thanks a lot, it worked for me as well. I did 'pip install transformers==4.26.1' which matches the version in requirements.txt

toshits commented 1 year ago

@mehulsuresh Thanks, facing the same issue. It resolved the issue