FIX_1: MPS and DML device errors on install
+VersionUP (0.5.0 alpha4)
This commit is contained in:
parent
524c4b78b3
commit
d57dc191d6
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
|
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
|
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||||
|
|
||||||
|
|||||||
21
install.py
21
install.py
@ -43,9 +43,12 @@ def get_sd_option(name: str, default: Any) -> Any:
|
|||||||
assert shared.opts.data is not None
|
assert shared.opts.data is not None
|
||||||
return shared.opts.data.get(name, default)
|
return shared.opts.data.get(name, default)
|
||||||
|
|
||||||
def run_pip(*args):
|
def pip_install(*args):
|
||||||
subprocess.run([sys.executable, "-m", "pip", "install", *args])
|
subprocess.run([sys.executable, "-m", "pip", "install", *args])
|
||||||
|
|
||||||
|
def pip_uninstall(*args):
|
||||||
|
subprocess.run([sys.executable, "-m", "pip", "uninstall", "-y", *args])
|
||||||
|
|
||||||
def is_installed (
|
def is_installed (
|
||||||
package: str, version: str | None = None, strict: bool = True
|
package: str, version: str | None = None, strict: bool = True
|
||||||
):
|
):
|
||||||
@ -96,10 +99,18 @@ with open(req_file) as file:
|
|||||||
install_count = 0
|
install_count = 0
|
||||||
try:
|
try:
|
||||||
ort = "onnxruntime-gpu"
|
ort = "onnxruntime-gpu"
|
||||||
import torch.cuda as cuda
|
import torch
|
||||||
if cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
if first_run:
|
if first_run:
|
||||||
last_device = "CUDA"
|
last_device = "CUDA"
|
||||||
|
elif torch.backends.mps.is_available() or hasattr(torch,'dml'):
|
||||||
|
ort = "onnxruntime"
|
||||||
|
# to prevent errors when ORT-GPU is installed but we want ORT instead:
|
||||||
|
if first_run:
|
||||||
|
pip_uninstall("onnxruntime", "onnxruntime-gpu")
|
||||||
|
# just in case:
|
||||||
|
if last_device == "CUDA":
|
||||||
|
last_device = "CPU"
|
||||||
else:
|
else:
|
||||||
if last_device == "CUDA":
|
if last_device == "CUDA":
|
||||||
last_device = "CPU"
|
last_device = "CPU"
|
||||||
@ -107,7 +118,7 @@ with open(req_file) as file:
|
|||||||
txt.write(last_device)
|
txt.write(last_device)
|
||||||
if not is_installed(ort,"1.16.1",False):
|
if not is_installed(ort,"1.16.1",False):
|
||||||
install_count += 1
|
install_count += 1
|
||||||
run_pip(ort)
|
pip_install(ort)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(f"\nERROR: Failed to install {ort} - ReActor won't start")
|
print(f"\nERROR: Failed to install {ort} - ReActor won't start")
|
||||||
@ -125,7 +136,7 @@ with open(req_file) as file:
|
|||||||
strict = False
|
strict = False
|
||||||
if not is_installed(package,package_version,strict):
|
if not is_installed(package,package_version,strict):
|
||||||
install_count += 1
|
install_count += 1
|
||||||
run_pip(package)
|
pip_install(package)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(f"\nERROR: Failed to install {package} - ReActor won't start")
|
print(f"\nERROR: Failed to install {package} - ReActor won't start")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
app_title = "ReActor"
|
app_title = "ReActor"
|
||||||
version_flag = "v0.5.0-a3"
|
version_flag = "v0.5.0-a4"
|
||||||
|
|
||||||
from scripts.reactor_logger import logger, get_Run, set_Run
|
from scripts.reactor_logger import logger, get_Run, set_Run
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user