mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-13 17:57:20 +02:00
Merge branch 'beta' into tjcomserv-patch-1-pydantic
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
cd /d %~dp0
|
||||
echo Install dir: %~dp0
|
||||
|
||||
set PATH=C:\Windows\System32;%PATH%
|
||||
set PATH=C:\Windows\System32;C:\Windows\System32\wbem;%PATH%
|
||||
set PYTHONHOME=
|
||||
|
||||
if exist "on_sd_start.bat" (
|
||||
|
@ -34,6 +34,7 @@ modules_to_check = {
|
||||
"sqlalchemy": "2.0.19",
|
||||
"python-multipart": "0.0.6",
|
||||
# "xformers": "0.0.16",
|
||||
"onnxruntime": "1.19.2",
|
||||
"huggingface-hub": "0.21.4",
|
||||
}
|
||||
modules_to_log = ["torch", "torchvision", "sdkit", "stable-diffusion-sdkit", "diffusers"]
|
||||
@ -298,7 +299,7 @@ Thanks!"""
|
||||
|
||||
def get_config():
|
||||
config_directory = os.path.dirname(__file__) # this will be "scripts"
|
||||
config_yaml = os.path.join(config_directory, "..", "config.yaml")
|
||||
config_yaml = os.path.abspath(os.path.join(config_directory, "..", "config.yaml"))
|
||||
config_json = os.path.join(config_directory, "config.json")
|
||||
|
||||
config = None
|
||||
|
@ -6,6 +6,7 @@ import shutil
|
||||
# The config file is in the same directory as this script
|
||||
config_directory = os.path.dirname(__file__)
|
||||
config_yaml = os.path.join(config_directory, "..", "config.yaml")
|
||||
config_yaml = os.path.abspath(config_yaml)
|
||||
config_json = os.path.join(config_directory, "config.json")
|
||||
|
||||
parser = argparse.ArgumentParser(description='Get values from config file')
|
||||
|
@ -71,6 +71,7 @@ if "%update_branch%"=="" (
|
||||
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
|
||||
@copy sd-ui-files\scripts\webui_console.py scripts\ /Y
|
||||
@copy "sd-ui-files\scripts\Start Stable Diffusion UI.cmd" . /Y
|
||||
@copy "sd-ui-files\scripts\Developer Console.cmd" . /Y
|
||||
|
||||
|
@ -54,6 +54,7 @@ cp sd-ui-files/scripts/bootstrap.sh scripts/
|
||||
cp sd-ui-files/scripts/check_modules.py scripts/
|
||||
cp sd-ui-files/scripts/get_config.py scripts/
|
||||
cp sd-ui-files/scripts/config.yaml.sample scripts/
|
||||
cp sd-ui-files/scripts/webui_console.py scripts/
|
||||
cp sd-ui-files/scripts/start.sh .
|
||||
cp sd-ui-files/scripts/developer_console.sh .
|
||||
cp sd-ui-files/scripts/functions.sh scripts/
|
||||
|
@ -7,6 +7,7 @@
|
||||
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
|
||||
@copy sd-ui-files\scripts\webui_console.py scripts\ /Y
|
||||
|
||||
if exist "%cd%\profile" (
|
||||
set HF_HOME=%cd%\profile\.cache\huggingface
|
||||
|
@ -6,16 +6,20 @@ cp sd-ui-files/scripts/bootstrap.sh scripts/
|
||||
cp sd-ui-files/scripts/check_modules.py scripts/
|
||||
cp sd-ui-files/scripts/get_config.py scripts/
|
||||
cp sd-ui-files/scripts/config.yaml.sample scripts/
|
||||
cp sd-ui-files/scripts/webui_console.py scripts/
|
||||
|
||||
|
||||
source ./scripts/functions.sh
|
||||
|
||||
# activate the installer env
|
||||
CONDA_BASEPATH=$(conda info --base)
|
||||
export CONDA_BASEPATH=$(conda info --base)
|
||||
source "$CONDA_BASEPATH/etc/profile.d/conda.sh" # avoids the 'shell not initialized' error
|
||||
|
||||
conda activate || fail "Failed to activate conda"
|
||||
|
||||
# hack to fix conda 4.14 on older installations
|
||||
cp $CONDA_BASEPATH/condabin/conda $CONDA_BASEPATH/bin/conda
|
||||
|
||||
# remove the old version of the dev console script, if it's still present
|
||||
if [ -e "open_dev_console.sh" ]; then
|
||||
rm "open_dev_console.sh"
|
||||
|
101
scripts/webui_console.py
Normal file
101
scripts/webui_console.py
Normal file
@ -0,0 +1,101 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
|
||||
def configure_env(dir):
|
||||
env_entries = {
|
||||
"PATH": [
|
||||
f"{dir}",
|
||||
f"{dir}/bin",
|
||||
f"{dir}/Library/bin",
|
||||
f"{dir}/Scripts",
|
||||
f"{dir}/usr/bin",
|
||||
],
|
||||
"PYTHONPATH": [
|
||||
f"{dir}",
|
||||
f"{dir}/lib/site-packages",
|
||||
f"{dir}/lib/python3.10/site-packages",
|
||||
],
|
||||
"PYTHONHOME": [],
|
||||
"PY_LIBS": [
|
||||
f"{dir}/Scripts/Lib",
|
||||
f"{dir}/Scripts/Lib/site-packages",
|
||||
f"{dir}/lib",
|
||||
f"{dir}/lib/python3.10/site-packages",
|
||||
],
|
||||
"PY_PIP": [f"{dir}/Scripts", f"{dir}/bin"],
|
||||
}
|
||||
|
||||
if platform.system() == "Windows":
|
||||
env_entries["PATH"].append("C:/Windows/System32")
|
||||
env_entries["PATH"].append("C:/Windows/System32/wbem")
|
||||
env_entries["PYTHONNOUSERSITE"] = ["1"]
|
||||
env_entries["PYTHON"] = [f"{dir}/python"]
|
||||
env_entries["GIT"] = [f"{dir}/Library/bin/git"]
|
||||
else:
|
||||
env_entries["PATH"].append("/bin")
|
||||
env_entries["PATH"].append("/usr/bin")
|
||||
env_entries["PATH"].append("/usr/sbin")
|
||||
env_entries["PYTHONNOUSERSITE"] = ["y"]
|
||||
env_entries["PYTHON"] = [f"{dir}/bin/python"]
|
||||
env_entries["GIT"] = [f"{dir}/bin/git"]
|
||||
|
||||
env = {}
|
||||
for key, paths in env_entries.items():
|
||||
paths = [p.replace("/", os.path.sep) for p in paths]
|
||||
paths = os.pathsep.join(paths)
|
||||
|
||||
os.environ[key] = paths
|
||||
|
||||
return env
|
||||
|
||||
|
||||
def print_env_info():
|
||||
which_cmd = "where" if platform.system() == "Windows" else "which"
|
||||
|
||||
python = "python"
|
||||
|
||||
def locate_python():
|
||||
nonlocal python
|
||||
|
||||
python = subprocess.getoutput(f"{which_cmd} python")
|
||||
python = python.split("\n")
|
||||
python = python[0].strip()
|
||||
print("python: ", python)
|
||||
|
||||
locate_python()
|
||||
|
||||
def run(cmd):
|
||||
with subprocess.Popen(cmd) as p:
|
||||
p.wait()
|
||||
|
||||
run([which_cmd, "git"])
|
||||
run(["git", "--version"])
|
||||
run([which_cmd, "python"])
|
||||
run([python, "--version"])
|
||||
|
||||
print(f"PATH={os.environ['PATH']}")
|
||||
|
||||
if platform.system() == "Windows":
|
||||
print(f"COMSPEC={os.environ['COMSPEC']}")
|
||||
print("")
|
||||
run("wmic path win32_VideoController get name,AdapterRAM,DriverDate,DriverVersion".split(" "))
|
||||
|
||||
print(f"PYTHONPATH={os.environ['PYTHONPATH']}")
|
||||
print("")
|
||||
|
||||
|
||||
def open_dev_shell():
|
||||
if platform.system() == "Windows":
|
||||
subprocess.Popen("cmd").communicate()
|
||||
else:
|
||||
subprocess.Popen("bash").communicate()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
env_dir = os.path.abspath(os.path.join("webui", "system"))
|
||||
|
||||
configure_env(env_dir)
|
||||
print_env_info()
|
||||
open_dev_shell()
|
Reference in New Issue
Block a user