From b74bf5638b3fa1b2ff1b91b4c3257983ab25a85b Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:15:25 -0700 Subject: [PATCH] Install extensions dependencies before webui dependencies webui takes precedence over extensions. --- webui.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/webui.py b/webui.py index e065b60..813ab83 100644 --- a/webui.py +++ b/webui.py @@ -19,7 +19,7 @@ with open(cmd_flags_path, 'r') as f: CMD_FLAGS = ' '.join(line.strip() for line in f.read().splitlines() if line.strip()) else: - CMD_FLAGS = '--chat' + CMD_FLAGS = '' # Remove the '# ' from the following lines as needed for your AMD GPU on Linux @@ -88,6 +88,9 @@ def install_dependencies(): print("D) None (I want to run models in CPU mode)") print() gpuchoice = input("Input> ").lower() + while gpuchoice not in ['a', 'b', 'c', 'd']: + print("Invalid choice. Please try again.") + gpuchoice = input("Input> ").lower() if gpuchoice == "d": print_big_message("Once the installation ends, make sure to open CMD_FLAGS.txt with\na text editor and add the --cpu flag.") @@ -109,10 +112,6 @@ def install_dependencies(): else: run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio", assert_success=True, environment=True) - else: - print("Invalid choice. Exiting...") - sys.exit() - # Clone webui to our computer run_cmd("git clone https://github.com/oobabooga/text-generation-webui.git", assert_success=True, environment=True) @@ -124,6 +123,17 @@ def update_dependencies(initial_installation=False): os.chdir("text-generation-webui") run_cmd("git pull", assert_success=True, environment=True) + # Install the extensions dependencies (only on the first install) + if initial_installation: + extensions = next(os.walk("extensions"))[1] + for extension in extensions: + if extension in ['superbooga']: # No wheels available for dependencies + continue + + extension_req_path = os.path.join("extensions", extension, "requirements.txt") + if os.path.exists(extension_req_path): + run_cmd("python -m pip install -r " + extension_req_path + " --upgrade", assert_success=True, environment=True) + textgen_requirements = open("requirements.txt").read().splitlines() # Workaround for git+ packages not updating properly Also store requirements.txt for later use @@ -142,17 +152,6 @@ def update_dependencies(initial_installation=False): # Installs/Updates the project dependencies run_cmd("python -m pip install -r requirements.txt --upgrade", assert_success=True, environment=True) - # Installs the extensions dependencies (only on the first install) - if initial_installation: - extensions = next(os.walk("extensions"))[1] - for extension in extensions: - if extension in ['superbooga']: # No wheels available for dependencies - continue - - extension_req_path = os.path.join("extensions", extension, "requirements.txt") - if os.path.exists(extension_req_path): - run_cmd("python -m pip install -r " + extension_req_path + " --upgrade", assert_success=True, environment=True) - # The following dependencies are for CUDA, not CPU # Parse output of 'pip show torch' to determine torch version torver_cmd = run_cmd("python -m pip show torch", assert_success=True, environment=True, capture_output=True)