Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
switch to packaged depencendies
Browse files Browse the repository at this point in the history
  • Loading branch information
rsxdalv committed Jul 5, 2023
1 parent d15006e commit 995d20d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 46 deletions.
1 change: 1 addition & 0 deletions graudio
Submodule graudio added at b49f52
58 changes: 12 additions & 46 deletions webui.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import argparse
import glob
import os
import shutil
import site
import subprocess
import sys

Expand All @@ -20,7 +17,7 @@ def check_env():
if conda_not_exist:
print("Conda is not installed. Exiting...")
sys.exit()

# Ensure this is a new environment and not the base environment
if os.environ["CONDA_DEFAULT_ENV"] == "base":
print("Create an environment for this project and activate it. Exiting...")
Expand All @@ -40,24 +37,23 @@ def install_dependencies():

# Install the version of PyTorch needed
if gpuchoice == "a":
run_cmd("conda install -y -k pytorch[version=2,build=py3.10_cuda11.7*] torchvision torchaudio pytorch-cuda=11.7 cuda-toolkit ninja git -c pytorch -c nvidia/label/cuda-11.7.0 -c nvidia")
run_cmd(
"conda install -y -k pytorch[version=2,build=py3.10_cuda11.7*] torchvision torchaudio pytorch-cuda=11.7 cuda-toolkit ninja git -c pytorch -c nvidia/label/cuda-11.7.0 -c nvidia"
)
elif gpuchoice == "b":
print("AMD GPUs are not supported. Exiting...")
sys.exit()
elif gpuchoice == "c" or gpuchoice == "d":
run_cmd("conda install -y -k pytorch torchvision torchaudio cpuonly git -c pytorch")
run_cmd(
"conda install -y -k pytorch torchvision torchaudio cpuonly git -c pytorch"
)
else:
print("Invalid choice. Exiting...")
sys.exit()

# Clone webui to our computer
run_cmd("conda install -y -c pytorch ffmpeg") # LGPL
run_cmd("git clone https://github.com/rsxdalv/tts-generation-webui.git")
run_cmd("git clone https://github.com/rsxdalv/bark.git tts-generation-webui/models/bark")
run_cmd("git clone https://github.com/rsxdalv/tortoise-tts.git tts-generation-webui/models/tortoise")
run_cmd("pip install python-dotenv")
run_cmd("pip install gradio")
run_cmd("pip install soundfile") # torchaudio platform windows
# run_cmd("pip install sox") # torchaudio platform linux

# Install the webui dependencies
update_dependencies()
Expand All @@ -67,41 +63,11 @@ def update_dependencies():
# Update the webui dependencies
os.chdir("tts-generation-webui")
run_cmd("git pull")

run_cmd("conda install -y -c pytorch ffmpeg") # LGPL

run_cmd("pip install -r requirements.txt")

os.chdir(script_dir)

os.chdir("tts-generation-webui/models/bark")
run_cmd("git pull")

# Installs/Updates dependencies from all requirements.txt
run_cmd("python -m pip install .")
os.chdir(script_dir)

os.chdir("tts-generation-webui/models/tortoise")
run_cmd("git pull")

# Installs/Updates dependencies from all requirements.txt
run_cmd("pip install transformers==4.19.0")
run_cmd("pip install -r requirements.txt")
run_cmd("python setup.py install")
run_cmd("conda install -y --channel=numba llvmlite")

os.chdir(script_dir)
# clone if doesn't exist
if not os.path.exists("tts-generation-webui/models/bark_voice_cloning_hubert_quantizer"):
run_cmd("git clone --branch hubert_only https://github.com/rsxdalv/bark-voice-cloning-HuBERT-quantizer tts-generation-webui/models/bark_voice_cloning_hubert_quantizer")

os.chdir("tts-generation-webui/models/bark_voice_cloning_hubert_quantizer")
# checkout to the correct branch
run_cmd("git checkout hubert_only")
run_cmd("git pull")

# Installs/Updates dependencies from all requirements.txt
run_cmd("pip install -r requirements.txt")
# For tortoise tts
# run_cmd("conda install -y --channel=numba llvmlite")


def run_model():
Expand All @@ -114,7 +80,7 @@ def run_model():
check_env()

parser = argparse.ArgumentParser()
parser.add_argument('--update', action='store_true', help='Update the web UI.')
parser.add_argument("--update", action="store_true", help="Update the web UI.")
args = parser.parse_args()

if args.update:
Expand All @@ -126,4 +92,4 @@ def run_model():
os.chdir(script_dir)

# Run the model with webui
run_model()
run_model()

0 comments on commit 995d20d

Please sign in to comment.