mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
More robust installation check for installer
This commit is contained in:
parent
cd1049eded
commit
498552a92b
14
webui.py
14
webui.py
@ -2,6 +2,7 @@ import argparse
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import site
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
script_dir = os.getcwd()
|
script_dir = os.getcwd()
|
||||||
@ -77,6 +78,16 @@ def clear_cache():
|
|||||||
run_cmd("conda clean -a -y", environment=True)
|
run_cmd("conda clean -a -y", environment=True)
|
||||||
run_cmd("python -m pip cache purge", environment=True)
|
run_cmd("python -m pip cache purge", environment=True)
|
||||||
|
|
||||||
|
def is_installed():
|
||||||
|
for sitedir in site.getsitepackages():
|
||||||
|
if "site-packages" in sitedir and conda_env_path in sitedir:
|
||||||
|
site_packages_path = sitedir
|
||||||
|
break
|
||||||
|
|
||||||
|
if site_packages_path:
|
||||||
|
return os.path.isfile(os.path.join(site_packages_path, 'torch', '__init__.py'))
|
||||||
|
else:
|
||||||
|
return os.path.isdir(conda_env_path)
|
||||||
|
|
||||||
def install_dependencies():
|
def install_dependencies():
|
||||||
# Select your GPU or, choose to run in CPU mode
|
# Select your GPU or, choose to run in CPU mode
|
||||||
@ -235,8 +246,7 @@ 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 is_installed():
|
||||||
if True: # TODO implement a new installation check
|
|
||||||
install_dependencies()
|
install_dependencies()
|
||||||
os.chdir(script_dir)
|
os.chdir(script_dir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user