From 799ce50b83138e85e6540c311107d883a7182da4 Mon Sep 17 00:00:00 2001 From: chucklesb <33965069+chucklesb@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:38:05 -0600 Subject: [PATCH 1/4] Update setup-cuda.sh Updated setup-cuda.sh to reflect the behavior of the updated Windows setup batch script. --- setup-cuda.sh | 118 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 104 insertions(+), 14 deletions(-) diff --git a/setup-cuda.sh b/setup-cuda.sh index 2c49c87..280f580 100644 --- a/setup-cuda.sh +++ b/setup-cuda.sh @@ -1,20 +1,110 @@ #!/bin/bash -# get local dependencies + +# Check if Python 3.11 is installed +python_bin='python3.11' +min_python_version='"3.11.0rc2"' + +$python_bin -m pip install --upgrade packaging +$python_bin -c "import platform; from packaging.version import Version; exit(Version(platform.python_version()) < Version(${min_python_version}))" +if [[ $? = 1 ]]; then + echo "Python 3.11 is not installed. Please install it and try again." + exit 1 +fi + +# Initialize and update git submodules git submodule init git submodule update --remote -# setup venv -python3 -m venv venv + +# Set up virtual environment with Python 3.11 +$python_bin -m venv venv source ./venv/bin/activate -python3 -m pip install --upgrade pip # just to be safe -# CUDA -pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 -# install requirements -python3 -m pip install -r ./modules/tortoise-tts/requirements.txt # install TorToiSe requirements -python3 -m pip install -e ./modules/tortoise-tts/ # install TorToiSe -python3 -m pip install -r ./modules/dlas/requirements.txt # instal DLAS requirements, last, because whisperx will break a dependency here -python3 -m pip install -e ./modules/dlas/ # install DLAS -python3 -m pip install -r ./requirements.txt # install local requirements -rm *.bat +# Upgrade pip and install required packages +pip install --upgrade pip +pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +pip install -r ./modules/tortoise-tts/requirements.txt +pip install -e ./modules/tortoise-tts/ +pip install -r ./modules/dlas/requirements.txt +pip install -e ./modules/dlas/ -deactivate \ No newline at end of file +# Download and extract RVC if not already done +file_name='rvc.zip' +download_rvc='https://huggingface.co/Jmica/rvc/resolve/main/rvc_lightweight.zip?download=true' +extracted_folder='rvc' + +# Delete previous rvc.zip if it exists +if [ -f $file_name ]; then + echo "Deleting previous ${file_name}..." + rm -f $file_name +fi + +if [ -d $extracted_folder ]; then + echo "The folder ${extracted_folder} already exists." + read -p "Do you want to delete it and re-extract? [y/N] " choice + if [[ $choice == [Yy]* ]]; then + echo "Deleting ${extracted_folder}..." + rm -rf $extracted_folder + fi +fi + +if ! [ -f $file_name ]; then + echo "Downloading ${file_name}..." + curl -L $download_rvc -o $file_name +else + echo "File ${file_name} already exists, skipping download." +fi + +echo "Extracting ${file_name}..." +$python_bin -m zipfile -e $file_name ./ +echo "RVC has finished downloading and Extracting." + +# Install RVC requirements +pip install -r ./rvc/requirements.txt + +# Prepare fairseq +fairseq_repo='https://github.com/VarunGumma/fairseq' +fairseq_folder='fairseq' + +if [ -d $fairseq_folder ]; then + git -C $fairseq_folder pull +else + git clone $fairseq_repo +fi + +if [ -d $fairseq_folder/wheels ]; then + rm -rf $fairseq_folder/wheels +fi + +# Prepare pyfastmp3decoder +pyfastmp3decoder_repo='https://github.com/neonbjb/pyfastmp3decoder.git' +pyfastmp3decoder_folder='pyfastmp3decoder' + +if [ -d $pyfastmp3decoder_folder ]; then + git -C $pyfastmp3decoder_folder pull +else + git clone --recurse-submodules $pyfastmp3decoder_repo +fi + +if [ -d $pyfastmp3decoder_folder/wheels ]; then + rm -rf $pyfastmp3decoder_folder/wheels +fi + +# Install Fairseq, Deepspeed, pyfast, and RVC TTS Pipeline +pip wheel ./$fairseq_folder/ -w ./$fairseq_folder/wheels/ +pip install ./$fairseq_folder/wheels/fairseq-*.whl +pip install git+https://github.com/JarodMica/rvc-tts-pipeline.git@lightweight#egg=rvc_tts_pipe +pip install deepspeed +pip wheel ./$pyfastmp3decoder_folder/ -w ./$pyfastmp3decoder_folder/wheels/ +pip install ./$pyfastmp3decoder_folder/wheels/pyfastmp3decoder-*.whl + +# Install whisperx +pip install git+https://github.com/m-bain/whisperx.git + +# Install other requirements (this is done last due to potential package conflicts) +pip install -r requirements.txt + +./start.sh +# Clean up +rm -f *.bat + +deactivate From 6c70e18323d59825e403139f98d6a9e75ecaabdb Mon Sep 17 00:00:00 2001 From: chucklesb <33965069+chucklesb@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:11:11 -0600 Subject: [PATCH 2/4] Update setup-cuda.sh --- setup-cuda.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-cuda.sh b/setup-cuda.sh index 280f580..4e259b1 100644 --- a/setup-cuda.sh +++ b/setup-cuda.sh @@ -7,7 +7,7 @@ min_python_version='"3.11.0rc2"' $python_bin -m pip install --upgrade packaging $python_bin -c "import platform; from packaging.version import Version; exit(Version(platform.python_version()) < Version(${min_python_version}))" if [[ $? = 1 ]]; then - echo "Python 3.11 is not installed. Please install it and try again." + echo "Python >= ${min_python_version} is not installed. Please install it and try again." exit 1 fi @@ -103,6 +103,7 @@ pip install git+https://github.com/m-bain/whisperx.git # Install other requirements (this is done last due to potential package conflicts) pip install -r requirements.txt +chmod +x ./start.sh ./start.sh # Clean up rm -f *.bat From af74035be6dde3b371a29d5dc8d0f3e413ad09a7 Mon Sep 17 00:00:00 2001 From: chucklesb <33965069+chucklesb@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:12:47 -0600 Subject: [PATCH 3/4] Create setup-cuda-cpu.sh Linux equivalent of setup-cuda-cpu.bat --- setup-cuda-cpu.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 setup-cuda-cpu.sh diff --git a/setup-cuda-cpu.sh b/setup-cuda-cpu.sh new file mode 100644 index 0000000..d5b3dd6 --- /dev/null +++ b/setup-cuda-cpu.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Check if Python 3.9 is installed +python_bin='python3.9' +min_python_version='"3.9.0"' + +$python_bin -m pip install --upgrade packaging +$python_bin -c "import platform; from packaging.version import Version; exit(Version(platform.python_version()) < Version(${min_python_version}))" +if [[ $? = 1 ]]; then + echo "Python >= ${min_python_version} is not installed. Please install it and try again." + exit 1 +fi + +# Initialize and update git submodules +git submodule init +git submodule update --remote + +# Set up virtual environment with Python 3.9 +$python_bin -m venv venv +source ./venv/bin/activate + +# Upgrade pip and install required packages +pip install --upgrade pip +pip install torch torchvision torchaudio +pip install -r ./modules/tortoise-tts/requirements.txt +pip install -e ./modules/tortoise-tts/ +pip install -r ./modules/dlas/requirements.txt +pip install -e ./modules/dlas/ + +# Download and extract RVC if not already done +file_name='rvc.zip' +download_rvc='https://huggingface.co/Jmica/rvc/resolve/main/rvc_lightweight.zip?download=true' +extracted_folder='rvc' + +if [ -d $extracted_folder ]; then + echo "The folder ${extracted_folder} already exists." + read -p "Do you want to delete it and re-extract? [y/N] " choice + if [[ $choice == [Yy]* ]]; then + echo "Deleting ${extracted_folder}..." + rm -rf $extracted_folder + fi +fi + +if ! [ -f $file_name ]; then + echo "Downloading ${file_name}..." + curl -L $download_rvc -o $file_name +else + echo "File ${file_name} already exists, skipping download." +fi + +echo "Extracting ${file_name}..." +$python_bin -m zipfile -e $file_name ./ +echo "RVC has finished downloading and Extracting." + +# Install RVC requirements +pip install -r ./rvc/requirements.txt + +# Prepare fairseq +fairseq_repo='https://github.com/pytorch/fairseq' +fairseq_folder='fairseq' + +if [ -d $fairseq_folder ]; then + git -C $fairseq_folder pull +else + git clone $fairseq_repo +fi + +if [ -d $fairseq_folder/wheels ]; then + rm -rf $fairseq_folder/wheels +fi + +# Install Fairseq and RVC TTS Pipeline +pip wheel ./$fairseq_folder/ -w ./$fairseq_folder/wheels/ +pip install ./$fairseq_folder/wheels/fairseq-*.whl +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) +pip install -r requirements.txt + +# Clean up +rm -f *.bat + +deactivate From 56c843f1b22915ef8209cdff49685b35f7163eba Mon Sep 17 00:00:00 2001 From: Jarod Mica <76232114+JarodMica@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:21:55 -0700 Subject: [PATCH 4/4] Update setup-cuda.sh Modifications to the logic for checking for Python 3.11 --- setup-cuda.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/setup-cuda.sh b/setup-cuda.sh index 4e259b1..ba186d6 100644 --- a/setup-cuda.sh +++ b/setup-cuda.sh @@ -2,12 +2,26 @@ # Check if Python 3.11 is installed python_bin='python3.11' -min_python_version='"3.11.0rc2"' -$python_bin -m pip install --upgrade packaging -$python_bin -c "import platform; from packaging.version import Version; exit(Version(platform.python_version()) < Version(${min_python_version}))" -if [[ $? = 1 ]]; then - echo "Python >= ${min_python_version} is not installed. Please install it and try again." +if ! command -v $python_bin &> /dev/null; then + echo "Python 3.11 is not installed. Please install it using the following command:" + echo "sudo apt install -y python3.11" + echo "After installing Python 3.11, please run the script again." + exit 1 +fi + +# Check if python3.11-venv is installed +if ! $python_bin -m venv --help &> /dev/null; then + echo "The python3.11-venv package is not installed. Please install it using the following command:" + echo "sudo apt install -y python3.11-venv" + echo "After installing the python3.11-venv package, please run the script again." + exit 1 +fi + +# Set up virtual environment with Python 3.11 +$python_bin -m venv venv +if [ $? -ne 0 ]; then + echo "Failed to create virtual environment. Please check the error message above and try again." exit 1 fi @@ -15,10 +29,6 @@ fi git submodule init git submodule update --remote -# Set up virtual environment with Python 3.11 -$python_bin -m venv venv -source ./venv/bin/activate - # Upgrade pip and install required packages pip install --upgrade pip pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121