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

xtts mode doesn't download model? #77

Closed
friki67 opened this issue Dec 4, 2023 · 7 comments · Fixed by #78 or #80
Closed

xtts mode doesn't download model? #77

friki67 opened this issue Dec 4, 2023 · 7 comments · Fixed by #78 or #80
Assignees
Labels
bug Something isn't working

Comments

@friki67
Copy link

friki67 commented Dec 4, 2023

epub2tts cosa.txt --xtts voz1/voz1-1.wav,voz1/voz1-2.wav,voz1/voz1-3.wav

Returns:

Namespace(sourcefile='cosa.txt', engine='tts', xtts='voz1/voz1-1.wav,voz1/voz1-2.wav,voz1/voz1-3.wav', openai='zzz', model='tts_models/en/vctk/vits', speaker='p335', scan=False, start=1, end=999, minratio=88, skiplinks=False, bitrate='69k', debug=False)

--- my Spanish text --

Saving to cosa-voz.m4b
Total characters: 214
Loading model: /home/ubuntu/.local/share/tts/tts_models--multilingual--multi-dataset--xtts_v2
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/epub2tts", line 8, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python3.10/site-packages/epub2tts.py", line 371, in main
mybook.read_book(voice_samples=args.xtts, engine=args.engine, openai=args.openai, model_name=args.model, speaker=args.speaker, bitrate=args.bitrate)
File "/home/ubuntu/.local/lib/python3.10/site-packages/epub2tts.py", line 225, in read_book
config.load_json(model_json)
File "/home/ubuntu/.local/lib/python3.10/site-packages/coqpit/coqpit.py", line 726, in load_json
with open(file_name, "r", encoding="utf8") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.local/share/tts/tts_models--multilingual--multi-dataset--xtts_v2/config.json'

and the folder tts_models--multilingual--multi-dataset--xtts_v2/ doesn't exists

Then I did epub2tts --bitrate 128k --model tts_models/multilingual/multi-dataset/xtts_v2 cosa.txt and agreed to the terms and conditions of the license. Just to download the model, then break the operation, re-run the inital command and it worked.

@aedocw
Copy link
Owner

aedocw commented Dec 4, 2023

Good catch, this is an issue where the path to voice samples is not handled properly (in my lazy testing the samples have all been in the same directory I'm working from!)

I'll fix this today, and confirm it catches the model properly as well.

@aedocw aedocw self-assigned this Dec 4, 2023
@friki67
Copy link
Author

friki67 commented Dec 4, 2023

Wonderful.

I have some issues with the language, again.

I wrote them in #71, just to keep things in place. Could you please have a look?

@aedocw
Copy link
Owner

aedocw commented Dec 4, 2023

Sorry I jumped to a wrong conclusion about what was going on here because I thought I had seem something similar once due to referencing the voice samples, but that was definitely not it.

I rely on TTS to detect whether or not the model is there, and if it's not, it should just download it. I'm really not sure what happened unless the model directory was there but it was not complete (i.e. missing config.json).

Let's let this open for now, and if you see it happen again please comment and I'll try harder to recreate the issue.

@aedocw aedocw linked a pull request Dec 4, 2023 that will close this issue
@aedocw aedocw closed this as completed in #78 Dec 4, 2023
@aedocw
Copy link
Owner

aedocw commented Dec 4, 2023

The merge did not fix this, re-opening this bug.

@aedocw aedocw reopened this Dec 4, 2023
@friki67
Copy link
Author

friki67 commented Dec 5, 2023

I rely on TTS to detect whether or not the model is there, and if it's not, it should just download it. I'm really not sure what happened unless the model directory was there but it was not complete (i.e. missing config.json).

The directory doesn't exists. The model isn't downloaded. I've reproduced the issue deleting all, reinstalling and using --xtts.
1- Install epub2tts
2- execute epub2tts mytext.txt --xtts voice1.wav,voice2.wav,voice3.wav
3- get the error, it doesn't try to download the model, just throw the error after the initial phase.

@aedocw
Copy link
Owner

aedocw commented Dec 5, 2023

Thanks - I've recreated this as well. I will play with how I'm initiating TTS so that it properly triggers the download.

@aedocw aedocw added the bug Something isn't working label Dec 5, 2023
@aedocw
Copy link
Owner

aedocw commented Dec 5, 2023

OK figured out what happened here... I had previously been using basically "plain" xtts v2, which will check to see if the model has been already downloaded and if not, downloads it and prompts for license agreement. Then I switched to using the model API so I could be more specific with some settings. The docs clearly state "To use the model API, you need to download the model files and pass config and model file paths manually." Oops! I didn't notice because I had already downloaded the model.

My clunky fix is to init tts in the more boring way first which will trigger the check to see if the model has already been downloaded. It's working for me, please validate when you get a chance and let me know if this has solved it for you.

@aedocw aedocw linked a pull request Dec 5, 2023 that will close this issue
@aedocw aedocw closed this as completed in #80 Dec 5, 2023
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.

2 participants