a yet another method to restart webui
This commit is contained in:
parent
9d953c0e03
commit
333e63c091
@ -244,6 +244,12 @@ def prepare_environment():
|
|||||||
codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
|
codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
|
||||||
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
|
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
|
||||||
|
|
||||||
|
try:
|
||||||
|
# the existance of this file is a signal to webui.sh/bat that webui needs to be restarted when it stops execution
|
||||||
|
os.remove(os.path.join(script_path, "tmp", "restart"))
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
if not args.skip_python_version_check:
|
if not args.skip_python_version_check:
|
||||||
check_python_version()
|
check_python_version()
|
||||||
|
|
||||||
|
@ -841,3 +841,12 @@ def walk_files(path, allowed_extensions=None):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
yield os.path.join(root, filename)
|
yield os.path.join(root, filename)
|
||||||
|
|
||||||
|
|
||||||
|
def restart_program():
|
||||||
|
"""creates file tmp/restart and immediately stops the process, which webui.bat/webui.sh interpret as a command to start webui again"""
|
||||||
|
|
||||||
|
with open(os.path.join(script_path, "tmp", "restart"), "w"):
|
||||||
|
pass
|
||||||
|
|
||||||
|
os._exit(0)
|
||||||
|
@ -49,7 +49,7 @@ def apply_and_restart(disable_list, update_list, disable_all):
|
|||||||
shared.opts.disabled_extensions = disabled
|
shared.opts.disabled_extensions = disabled
|
||||||
shared.opts.disable_all_extensions = disable_all
|
shared.opts.disable_all_extensions = disable_all
|
||||||
shared.opts.save(shared.config_filename)
|
shared.opts.save(shared.config_filename)
|
||||||
shared.state.request_restart()
|
shared.restart_program()
|
||||||
|
|
||||||
|
|
||||||
def save_config_state(name):
|
def save_config_state(name):
|
||||||
|
@ -51,12 +51,14 @@ if EXIST %ACCELERATE% goto :accelerate_launch
|
|||||||
|
|
||||||
:launch
|
:launch
|
||||||
%PYTHON% launch.py %*
|
%PYTHON% launch.py %*
|
||||||
|
if EXIST tmp/restart goto :skip_venv
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:accelerate_launch
|
:accelerate_launch
|
||||||
echo Accelerating
|
echo Accelerating
|
||||||
%ACCELERATE% launch --num_cpu_threads_per_process=6 launch.py
|
%ACCELERATE% launch --num_cpu_threads_per_process=6 launch.py
|
||||||
|
if EXIST tmp/restart goto :skip_venv
|
||||||
pause
|
pause
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
|
14
webui.sh
14
webui.sh
@ -203,17 +203,23 @@ prepare_tcmalloc() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]
|
KEEP_GOING=1
|
||||||
then
|
while [[ "$KEEP_GOING" -eq "1" ]]; do
|
||||||
|
if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]; then
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
printf "Accelerating launch.py..."
|
printf "Accelerating launch.py..."
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
prepare_tcmalloc
|
prepare_tcmalloc
|
||||||
exec accelerate launch --num_cpu_threads_per_process=6 "${LAUNCH_SCRIPT}" "$@"
|
accelerate launch --num_cpu_threads_per_process=6 "${LAUNCH_SCRIPT}" "$@"
|
||||||
else
|
else
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
printf "Launching launch.py..."
|
printf "Launching launch.py..."
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
prepare_tcmalloc
|
prepare_tcmalloc
|
||||||
exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@"
|
"${python_cmd}" "${LAUNCH_SCRIPT}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f tmp/restart ]]; then
|
||||||
|
KEEP_GOING=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user