tortoise-tts
tortoise-tts copied to clipboard
Guide: How to install on windows for GPU
Hey,
I spent the last 10 hours trying to install tortoise-tts on windows 10 with CUDA GPU support, and finally got it working. I thought I would share my instructions to help others in case anyone else gets stuck.
-
Create
environment.yml
file:name: tortoise channels: - conda-forge dependencies: - python=3.8 - charset-normalizer - pip - pillow
-
Create a new requirements.txt named
requirements.new.txt
. the old one requirements.txt has some issues.tqdm rotary_embedding_torch transformers==4.19 tokenizers inflect progressbar einops==0.4.1 unidecode scipy==1.10.1 librosa==0.9.1 numba ffmpeg numpy threadpoolctl llvmlite appdirs soundfile
-
Then run the following:
- create a local conda environment in the ./env folder
conda env create -f environment.yml -p ./env
- activate the conda environment
source activate ./env # if this doesn't work, use: "conda activate ./env"
- Install torch and cuda
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
- Install the
requirements.new.txt
filepython -m pip install -r requirements.new.txt
- Run the setup.py file, which is necessary in order for some of the tortoise imports to run.
python setup.py install
Alternatively, you can try doing this in one shot:
conda env create -f environment.yml -p ./env \ && source activate ./env && conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia -y && python -m pip install -r requirements.new.txt && python setup.py install
- create a local conda environment in the ./env folder
-
you can test if it worked using the following:
# test cuda is working. should print true that gpu is available.
python -c "import torch; print(torch.cuda.is_available());torch.zeros(1).cuda()"
# test tortoise:
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
Hopefully this helps.
Thanks for posting. It worked for me. I agree that it would be very helpful to this as part of a readme.
I have a Win11 64bit setup using Anaconda Navigator 2.4.0.
Reproducing the steps above work fine, until # test tortoise: python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
is executed.
Then I get the following:
UserWarning: torchaudio C++ extension is not available. warnings.warn('torchaudio C++ extension is not available.') Traceback (most recent call last): File "tortoise/do_tts.py", line 7, in <module> from api import TextToSpeech, MODELS_DIR File "C:\xxx\yyy\tortoise-tts\tortoise\api.py", line 13, in <module> from tortoise.models.diffusion_decoder import DiffusionTts File "C:\xxx\yyy\env\lib\site-packages\tortoise-2.4.2-py3.8.egg\tortoise\models\diffusion_decoder.py", line 8, in <module> from torch import autocast ImportError: cannot import name 'autocast' from 'torch' (C:\xxx\yyy\env\lib\site-packages\torch\__init__.py)
Looking for a solution to torchaudio C++ extension is not available.
tells me, that this extension is not available on Windows.
Any ideas here? Thank you!
Any ideas here? Thank you!
I used this line to install pytorch and torch audio. It's probably will be specific to your version of CUDA installed, but for me it works for all of the places where pytorch and cuda is required
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118
I also have win11 and Anaconda, so I think torchaudio is available, but just not installed correctly
you can also try rerunning the torchaudio installation:
conda activate ./env
conda install torchaudio -c pytorch -c nvidia
Otherwise, you might need to have visual studio community edition installed to get the c++ compilers.
That did the trick! Thank you!
What Python version did you use when creating the conda environment? Can you use multiple GPUs, e.g. GPU0 and GPU1 ?
what if you have Cuda 12.0 ?
CUDA 12 is not supported by PyTorch You should uninstall CUDA12
For 40xx cards, you have to use CUDA18
Use this instead.
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
You might want to use the mrq repo. It has directml support