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

[Bug] Version 0.25.2 breaks the fairseq models #263

Closed
DrewThomasson opened this issue Jan 16, 2025 · 2 comments · Fixed by #264
Closed

[Bug] Version 0.25.2 breaks the fairseq models #263

DrewThomasson opened this issue Jan 16, 2025 · 2 comments · Fixed by #264
Assignees
Labels
bug Something isn't working

Comments

@DrewThomasson
Copy link

Describe the bug

Version 0.25.2 Is causing issues with fairseq
For Example when the eng.tar.gz is downloaded and extracted the G_100000.pth is being renamed to model.pth
This is causing issues as you might expect when the fairseq engine is looking for the G_100000.pth file and can't find it


To Reproduce

Try to use the "eng" fairseq model

This is what the zip should look like

wget https://dl.fbaipublicfiles.com/mms/tts/eng.tar.gz

Expected behavior

Expected output of that zip are the files

G_100000.pth config.json vocab.txt

But instead its getting

model.pth config.json vocab.txt

If I Rename the model.pth to G_100000.pth then the model loads fine, confirming my suspicion

They also have the same shard

Logs

Idk I forgot to get it but its pretty self-evident when you re-download the English fairseq model to use fully with coqui-tts

oh there was this

 bash

FileNotFoundError: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth'
Caught DependencyError: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth'
convert_ebook() Exception: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth' 

s]Traceback (most recent call last):
File "/Users/drew/ebook2audiobook/lib/functions.py", line 694, in convert_chapters_to_audio
params['tts'] = load_tts_api_cached(model_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/lib/functions.py", line 634, in load_tts_api_cached
tts = XTTS(model_path)
^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/api.py", line 96, in init
self.load_tts_model_by_name(model_name, vocoder_name, gpu=gpu)
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/api.py", line 226, in load_tts_model_by_name
self.synthesizer = Synthesizer(
^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/utils/synthesizer.py", line 109, in init
self._load_fairseq_from_dir(model_dir, use_cuda)
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/utils/synthesizer.py", line 157, in _load_fairseq_from_dir
self.tts_model.load_fairseq_checkpoint(self.tts_config, checkpoint_dir=model_dir, eval=True)
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/tts/models/vits.py", line 1605, in load_fairseq_checkpoint
new_chk = rehash_fairseq_vits_checkpoint(checkpoint_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/TTS/tts/utils/fairseq.py", line 7, in rehash_fairseq_vits_checkpoint
chk = torch.load(checkpoint_file, map_location=torch.device("cpu"), weights_only=is_pytorch_at_least_2_4())["model"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/torch/serialization.py", line 1319, in load
with _open_file_like(f, "rb") as opened_file:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/torch/serialization.py", line 659, in _open_file_like
return _open_file(name_or_buffer, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/drew/ebook2audiobook/python_env/lib/python3.12/site-packages/torch/serialization.py", line 640, in init
super().init(open(name, mode))
^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth'
Caught DependencyError: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth'
convert_ebook() Exception: [Errno 2] No such file or directory: '/Users/drew/ebook2audiobook/models/tts/tts_models--eng--fairseq--vits/G_100000.pth'
100%|█████████████████████████████████████████████████| 135M/135M [00:30<00:00, 8.23MiB/s]



### Environment

```shell
on m1 MAC pro apple silicon 16gb ram 

issues arrises when using 

`coqui-tts==0.25.2`

Additional context

If I revert back to coqui-tts==0.25.1 then the issue goes away so

yeah

@DrewThomasson DrewThomasson added the bug Something isn't working label Jan 16, 2025
@eginhard eginhard self-assigned this Jan 16, 2025
@eginhard
Copy link
Member

@ROBERT-MCDOWELL @DrewThomasson Thanks for spotting this issue quickly, will release a new version with a fix (#264) today. It will accept both G_100000.pth and model.pth so it should work for any already downloaded models. Also added a test for the fairseq models to avoid similar issues in the future.

@ROBERT-MCDOWELL
Copy link

ROBERT-MCDOWELL commented Jan 16, 2025

Thanks @eginhard !!! True sometimes models have other names than model.pth....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants