Basic changes

This commit is contained in:
oobabooga 2023-09-21 15:42:37 -07:00
parent b04b3957f9
commit fc2b831692

View File

@ -112,16 +112,12 @@ def install_dependencies():
else: else:
run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio", assert_success=True, environment=True) run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio", assert_success=True, environment=True)
# Clone webui to our computer
run_cmd("git clone https://github.com/oobabooga/text-generation-webui.git", assert_success=True, environment=True)
# Install the webui dependencies # Install the webui dependencies
update_dependencies(initial_installation=True) update_dependencies(initial_installation=True)
def update_dependencies(initial_installation=False): def update_dependencies(initial_installation=False):
os.chdir("text-generation-webui") # run_cmd("git pull", assert_success=True, environment=True) # TODO uncomment before merging (is there a better way?)
run_cmd("git pull", assert_success=True, environment=True)
# Install the extensions dependencies (only on the first install) # Install the extensions dependencies (only on the first install)
if initial_installation: if initial_installation:
@ -215,12 +211,10 @@ def update_dependencies(initial_installation=False):
def download_model(): def download_model():
os.chdir("text-generation-webui")
run_cmd("python download-model.py", environment=True) run_cmd("python download-model.py", environment=True)
def launch_webui(): def launch_webui():
os.chdir("text-generation-webui")
run_cmd(f"python server.py {CMD_FLAGS}", environment=True) run_cmd(f"python server.py {CMD_FLAGS}", environment=True)
@ -236,7 +230,8 @@ if __name__ == "__main__":
update_dependencies() update_dependencies()
else: else:
# If webui has already been installed, skip and run # If webui has already been installed, skip and run
if not os.path.exists("text-generation-webui/"): # if not os.path.exists("text-generation-webui/"):
if True: # TODO implement a new installation check
install_dependencies() install_dependencies()
os.chdir(script_dir) os.chdir(script_dir)