From e5a22340efeebe347e0a24556ad4e72acd8c3e8b Mon Sep 17 00:00:00 2001 From: meokbodizi Date: Sun, 4 Aug 2024 22:49:49 +0900 Subject: [PATCH 1/2] Update reactor_helpers.py Why not. --- scripts/reactor_helpers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/reactor_helpers.py b/scripts/reactor_helpers.py index 6c31dfe6..ea8b9add 100644 --- a/scripts/reactor_helpers.py +++ b/scripts/reactor_helpers.py @@ -175,9 +175,13 @@ def save_face_model(face: Face, filename: str) -> None: def get_models(): global MODELS_PATH - models_path_init = os.path.join(models_path, "insightface/*") - models = glob.glob(models_path_init) + models_path_init = os.path.join(models_path, "insightface/**/*") + models = glob.glob(models_path_init, recursive=True) models = [x for x in models if x.endswith(".onnx") or x.endswith(".pth")] + model_inswapper = os.path.join(models_path, "insightface/inswapper_128.onnx") + model_inswapper_lost = [path for path in models if 'inswapper_128.onnx' in path and os.path.split(path)[0].split('\\')[-1] != "insightface"] + if model_inswapper_lost and not os.path.exists(model_inswapper): + os.rename(model_inswapper_lost, model_inswapper) models_names = [] for model in models: model_path = os.path.split(model) From a8fbb72f7bcff523c3bafe045f81c314f3e6339d Mon Sep 17 00:00:00 2001 From: meokbodizi Date: Sun, 4 Aug 2024 22:58:24 +0900 Subject: [PATCH 2/2] Update reactor_helpers.py --- scripts/reactor_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/reactor_helpers.py b/scripts/reactor_helpers.py index ea8b9add..801eab81 100644 --- a/scripts/reactor_helpers.py +++ b/scripts/reactor_helpers.py @@ -181,7 +181,7 @@ def get_models(): model_inswapper = os.path.join(models_path, "insightface/inswapper_128.onnx") model_inswapper_lost = [path for path in models if 'inswapper_128.onnx' in path and os.path.split(path)[0].split('\\')[-1] != "insightface"] if model_inswapper_lost and not os.path.exists(model_inswapper): - os.rename(model_inswapper_lost, model_inswapper) + os.rename(model_inswapper_lost[0], model_inswapper) models_names = [] for model in models: model_path = os.path.split(model)