mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Make webui.py more readable
This commit is contained in:
parent
c74326de02
commit
ccfc919016
33
webui.py
33
webui.py
@ -113,29 +113,30 @@ def install_dependencies():
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
# Select your GPU, or choose to run in CPU mode
|
# Select your GPU, or choose to run in CPU mode
|
||||||
gpuchoice = input("Input> ").lower()
|
choice = input("Input> ").upper()
|
||||||
while gpuchoice not in ['a', 'b', 'c', 'd']:
|
while choice not in ['A', 'B', 'C', 'D']:
|
||||||
print("Invalid choice. Please try again.")
|
print("Invalid choice. Please try again.")
|
||||||
gpuchoice = input("Input> ").lower()
|
choice = input("Input> ").upper()
|
||||||
if gpuchoice == "d":
|
if choice == "D":
|
||||||
print_big_message("Once the installation ends, make sure to open CMD_FLAGS.txt with\na text editor and add the --cpu flag.")
|
print_big_message("Once the installation ends, make sure to open CMD_FLAGS.txt with\na text editor and add the --cpu flag.")
|
||||||
|
|
||||||
# Install Pytorch
|
# Find the proper Pytorch installation command
|
||||||
if gpuchoice == "a":
|
install_git = "conda install -y -k ninja git"
|
||||||
run_cmd('conda install -y -k ninja git && python -m pip install torch==2.0.1+cu117 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117', assert_success=True, environment=True)
|
install_pytorch = "python -m pip install torch torchvision torchaudio"
|
||||||
elif gpuchoice == "b" and not is_macos():
|
|
||||||
|
if choice == "A":
|
||||||
|
install_pytorch = "python -m pip install torch==2.0.1+cu117 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117"
|
||||||
|
elif is_macos() and choice == "B":
|
||||||
if is_linux():
|
if is_linux():
|
||||||
run_cmd('conda install -y -k ninja git && python -m pip install torch==2.0.1+rocm5.4.2 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2', assert_success=True, environment=True)
|
install_pytorch = "python -m pip install torch==2.0.1+rocm5.4.2 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2"
|
||||||
else:
|
else:
|
||||||
print("AMD GPUs are only supported on Linux. Exiting...")
|
print("AMD GPUs are only supported on Linux. Exiting...")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif (gpuchoice == "c" or gpuchoice == "b") and is_macos():
|
elif is_linux() and (choice == "C" or choice == "D"):
|
||||||
run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio", assert_success=True, environment=True)
|
install_pytorch = "python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu"
|
||||||
elif gpuchoice == "d" or gpuchoice == "c":
|
|
||||||
if is_linux():
|
# Install Git and then Pytorch
|
||||||
run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu", assert_success=True, environment=True)
|
run_cmd(f"{install_git} && {install_pytorch}", assert_success=True, environment=True)
|
||||||
else:
|
|
||||||
run_cmd("conda install -y -k ninja git && python -m pip install torch torchvision torchaudio", assert_success=True, environment=True)
|
|
||||||
|
|
||||||
# Install the webui dependencies
|
# Install the webui dependencies
|
||||||
update_dependencies(initial_installation=True)
|
update_dependencies(initial_installation=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user