Thanks to Coqui_tts
And yeah... you may need a high-end graphic card, probably a Nvidia one, if you want to use Cuda.
(We suppose here that you already have a basic system, with the basic usual tools you need to have, to play with AI models to create pictures, to talk, to code, to chat and so on. )
If yes click, click on "read more" and then click here to scroll down
If not and if you are interested to know more, please install first:
(I ll suppose you have a window system).
- Python, link: https://www.python.org/downloads/windows/
(today: I would still install python 3.10.6, but in the future I would just take the 3rd latest version of Python [to prevent compatibility issues])
First find where python has been installed.
Open the files locations several times, in the start menu, for the python version that you have.
At the end, you should find that python is installed in a directory like that:C:\Users\[username]\AppData\Local\Programs\Python\Python310
AppData is usually not a visible directory if you decide to access through:C:\Users\[username]\
So you may have to type it manually.
So remember this directory, we will add it the "PATH"
How to add Python to the PATH?
Go to the settings of the computer (the little gear symbol), Go to the "About" section (bottom of the left menu)
Click on "advanced system settings"(right side), Environment Variables (in "Advanced"), select Path and then edit to create one line and paste the directory where python is saved.
At this point, you can open a command window and test if you can access python.python --version
You can keep the PATH menu open.
Now install pip:
And follow these instructions:https://pip.pypa.io/en/stable/installation/
Then git,:https://git-scm.com/downloads
And Conda:
https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html
How to install coqui_tts in a dedicated environment ?
Do, in an anaconda terminal (or "Anaconda Prompt" [You access that from the start menu]):
conda create --name coqui python=3.10.6
Proceed: Yes
conda activate coqui
Here it is important to know if Cuda is already installed on your computer and if yes, what is the version on your computer. If you don't have Cuda, Coqui_tts will likely use the CPU to do its job and it will be much slower (barely usable, in fact).
Type:
nvcc --version
Then see if Cuda is already installed. If it is not installed, you have to know what is the version of Cuda you want to install. It is probably a good idea to check here what is the latest version of Cuda to try this one. In case, later, conda can't find the good packages, you will have later to use a search engine to retrieve the version of Cuda that works for you (one of the archive of Nvidia).
I understand (?) that you have more or less to have one version of Cuda for several environments of "conda".
Install Cuda and Pytorch:
So let's say, there is already a version of Cuda 11.7 installed on your computer or that you want to install this specific version. In this case, do this:
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Personally, i have a version 12.1, so i replace 11.7 by 12.1 in the line above.
(this takes time, to install)
Proceed: Yes
Type enter if it feels stuck.
If Cuda wasn't installed, you need to install it now. Click here to download the latest version of Cuda. Make sure to match the version of Cuda with your own version of pytorch-cuda, that is installed on computer. If you need another version, use a search engine to find it.
To check if Cuda works, type this in a terminal in the "coqui" environment:
Type:
python
import torch
print(torch.cuda.is_available())
It should return true.
then type:
exit() to exit python.
If your installation of Cuda didn't work, i suggest you to follow this dedicated tutorial.
Let's finally install coqui_tts:
pip install TTS
Understand that now, to use any code related to TTS, you'll need to go and activate each time the conda environment.
(conda activate coqui
)
Type this to test the command line:
tts --text "This should give a sentence if everything is correctly installed." --out_path speech.wav
This should give a sentence, if everything is correctly installed, saved in the file speech.wav
For more tips, read the end of this page to see how to use a wav file as a reference to change the voice of the result and an example about how to code in python with Coqui_tts.
In the next tutorial, i'll show how to use coqui_tts to listen to the written articles of your favorite website.