From 4139d167ff1299a8450a3b4bcbc50dec6cd0690d Mon Sep 17 00:00:00 2001
From: Gourieff <777@lovemet.ru>
Date: Mon, 6 Nov 2023 04:32:37 +0700
Subject: [PATCH] FIX: AMD/MacM1,2 not launch issue
Issues: #175 #176 #177
VersionUP (0.5.0 beta1)
Thanks @darktar for the help in detecting the error
---
README.md | 2 +-
README_RU.md | 2 +-
scripts/reactor_faceswap.py | 78 +++++++++++++++++--------------------
scripts/reactor_version.py | 2 +-
4 files changed, 38 insertions(+), 46 deletions(-)
diff --git a/README.md b/README.md
index 3cb80a1..c8c8e94 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
- 
+ 
diff --git a/README_RU.md b/README_RU.md
index e0088ff..c96f85c 100644
--- a/README_RU.md
+++ b/README_RU.md
@@ -2,7 +2,7 @@
- 
+ 
diff --git a/scripts/reactor_faceswap.py b/scripts/reactor_faceswap.py
index 125e270..4499b15 100644
--- a/scripts/reactor_faceswap.py
+++ b/scripts/reactor_faceswap.py
@@ -3,8 +3,9 @@ import gradio as gr
from PIL import Image
try:
import torch.cuda as cuda
+ EP_is_visible = True if cuda.is_available() else False
except:
- cuda = None
+ EP_is_visible = False
from typing import List
@@ -139,29 +140,23 @@ class FaceSwapScript(scripts.Script):
)
with gr.Tab("Settings"):
models = get_models()
- if cuda is not None:
- if cuda.is_available():
- with gr.Row():
- device = gr.Radio(
- label="Execution Provider",
- choices=DEVICE_LIST,
- value=DEVICE,
- type="value",
- info="If you already run 'Generate' - RESTART is required to apply. Click 'Save', (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again",
- scale=2,
- )
- save_device_btn = gr.Button("Save", scale=0)
- save = gr.Markdown("")
- setattr(device, "do_not_save_to_config", True)
- save_device_btn.click(
- set_Device,
- inputs=[device],
- outputs=[save],
- )
- else:
- device = "CPU"
- else:
- device = "CPU"
+ with gr.Row(visible=EP_is_visible):
+ device = gr.Radio(
+ label="Execution Provider",
+ choices=DEVICE_LIST,
+ value=DEVICE,
+ type="value",
+ info="If you already run 'Generate' - RESTART is required to apply. Click 'Save', (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again",
+ scale=2,
+ )
+ save_device_btn = gr.Button("Save", scale=0)
+ save = gr.Markdown("", visible=EP_is_visible)
+ setattr(device, "do_not_save_to_config", True)
+ save_device_btn.click(
+ set_Device,
+ inputs=[device],
+ outputs=[save],
+ )
with gr.Row():
if len(models) == 0:
logger.warning(
@@ -533,26 +528,23 @@ class FaceSwapScriptExtras(scripts_postprocessing.ScriptPostprocessing):
)
with gr.Tab("Settings"):
models = get_models()
- if cuda.is_available():
- with gr.Row():
- device = gr.Radio(
- label="Execution Provider",
- choices=DEVICE_LIST,
- value=DEVICE,
- type="value",
- info="If you already run 'Generate' - RESTART is required to apply. Click 'Save', (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again",
- scale=2,
- )
- save_device_btn = gr.Button("Save", scale=0)
- save = gr.Markdown("")
- setattr(device, "do_not_save_to_config", True)
- save_device_btn.click(
- set_Device,
- inputs=[device],
- outputs=[save],
+ with gr.Row(visible=EP_is_visible):
+ device = gr.Radio(
+ label="Execution Provider",
+ choices=DEVICE_LIST,
+ value=DEVICE,
+ type="value",
+ info="If you already run 'Generate' - RESTART is required to apply. Click 'Save', (A1111) Extensions Tab -> 'Apply and restart UI' or (SD.Next) close the Server and start it again",
+ scale=2,
)
- else:
- device = "CPU"
+ save_device_btn = gr.Button("Save", scale=0)
+ save = gr.Markdown("", visible=EP_is_visible)
+ setattr(device, "do_not_save_to_config", True)
+ save_device_btn.click(
+ set_Device,
+ inputs=[device],
+ outputs=[save],
+ )
with gr.Row():
if len(models) == 0:
logger.warning(
diff --git a/scripts/reactor_version.py b/scripts/reactor_version.py
index dad5874..22a164c 100644
--- a/scripts/reactor_version.py
+++ b/scripts/reactor_version.py
@@ -1,5 +1,5 @@
app_title = "ReActor"
-version_flag = "v0.5.0-a5"
+version_flag = "v0.5.0-b1"
from scripts.reactor_logger import logger, get_Run, set_Run