Added CPU inference and CPU test branch

This commit is contained in:
Jarod Mica 2024-01-25 00:57:56 -08:00
parent 99305336bf
commit a7e77ebc67
3 changed files with 100 additions and 0 deletions

2
.gitignore vendored
View file

@ -1,5 +1,6 @@
# ignores user files # ignores user files
/venv/ /venv/
/venv_cpu/
/models/* /models/*
/training/* /training/*
/config/* /config/*
@ -7,6 +8,7 @@ output/
*.wav *.wav
fairseq-0.12.2-cp39-cp39-win_amd64.whl fairseq-0.12.2-cp39-cp39-win_amd64.whl
rvc/ rvc/
*.zip
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

View file

@ -1,5 +1,15 @@
# Changelogs & Notes # Changelogs & Notes
## 1/25/2024
Started working on CPU inference capabilities. I don't think training is even a thing on CPU so not even going to try
- CPU enabled for inferencing, works with RVC on/off
- It's very slow, roughly 5-10x slower than GPU but it works
- Causes for this are lack of deepspeed compatibility on windows
- Hifigan DOES NOT work with CPU inferencing ATM. Not sure what the issue is or what is causing it, so I'm trying to figure that out
- Currently looking to see if there are options to speed up CPU inference.
- BetterTransformers via optimum - didn't notice any difference here, could be doing it wrong
- Deepspeed for windows - requires a linux OS to my research. You have to do some type of intel for pytorch / deepspeed install and there are additional pieces that have wheels only built for linux.
## 1/15/2024 ## 1/15/2024
- Manual installation of this with RVC will be quite the hassle due to the assets folder, so what I'll do is put that on HF so that can be downloaded and put into the rvc folder - Manual installation of this with RVC will be quite the hassle due to the assets folder, so what I'll do is put that on HF so that can be downloaded and put into the rvc folder

88
setup-cuda-cpu.bat Normal file
View file

@ -0,0 +1,88 @@
@echo off
setlocal enabledelayedexpansion
:: Check if Python 3.9 is installed
py -3.9 --version >nul 2>&1
if errorlevel 1 (
echo Python 3.9 is not installed. Please install it and try again.
pause
exit /b 1
)
:: Initialize and update git submodules
git submodule init
git submodule update --remote
:: Set up virtual environment with Python 3.9
py -3.9 -m venv venv
call .\venv\Scripts\activate.bat
:: Upgrade pip and install required packages
python -m pip install --upgrade pip
python -m pip install torch torchvision torchaudio
python -m pip install -r .\modules\tortoise-tts\requirements.txt
python -m pip install -e .\modules\tortoise-tts\
python -m pip install -r .\modules\dlas\requirements.txt
python -m pip install -e .\modules\dlas\
@REM python -m pip install deepspeed-0.8.3+6eca037c-cp39-cp39-win_amd64.whl
:: Download and extract RVC if not already done
set file_name=rvc.zip
set download_rvc=https://huggingface.co/Jmica/rvc/resolve/main/rvc_lightweight.zip?download=true
set extracted_folder=rvc
if exist "%extracted_folder%" (
echo The folder %extracted_folder% already exists.
choice /C YN /M "Do you want to delete it and re-extract (Y/N)?"
if errorlevel 2 goto SkipDeletion
if errorlevel 1 (
echo Deleting %extracted_folder%...
rmdir /S /Q "%extracted_folder%"
)
)
:SkipDeletion
if not exist "%file_name%" (
echo Downloading %file_name%...
curl -L %download_rvc% -o %file_name%
) else (
echo File %file_name% already exists, skipping download.
)
echo Extracting %file_name%...
tar -xf %file_name%
echo RVC has finished downloading and Extracting.
:: Install RVC requirements
python -m pip install -r .\rvc\requirements.txt
:: Download and install Fairseq if not already done
set download_fairseq=https://huggingface.co/Jmica/rvc/resolve/main/fairseq-0.12.2-cp39-cp39-win_amd64.whl?download=true
set file_name=fairseq-0.12.2-cp39-cp39-win_amd64.whl
if not exist "%file_name%" (
echo Downloading %file_name%...
curl -L -O "%download_fairseq%"
if errorlevel 1 (
echo Download failed. Please check your internet connection or the URL and try again.
exit /b 1
)
) else (
echo File %file_name% already exists, skipping download.
)
:: Install Fairseq and RVC TTS Pipeline
python -m pip install .\fairseq-0.12.2-cp39-cp39-win_amd64.whl
python -m pip install git+https://github.com/JarodMica/rvc-tts-pipeline.git@lightweight#egg=rvc_tts_pipe
:: Install other requirements (this is done last due to potential package conflicts)
python -m pip install -r .\requirements.txt
:: Setup BnB
.\setup-cuda-bnb.bat
:: Clean up
del *.sh
pause
deactivate