main
Tran Xen 2 years ago
parent bf8ef5e9ec
commit c94d2aab4d

@ -62,5 +62,11 @@ def check_install() -> None:
import timeit import timeit
try:
check_time = timeit.timeit(check_install, number=1) check_time = timeit.timeit(check_install, number=1)
print(check_time) print(check_time)
except Exception as e:
print("FaceswapLab install failed", e)
print(
"You can try to install dependencies manually by activating venv and installing requirements.txt or requirements-gpu.txt"
)

@ -1,5 +1,4 @@
cython cython
dill
ifnude ifnude
insightface==0.7.3 insightface==0.7.3
onnx>=1.14.0 onnx>=1.14.0

@ -1,6 +1,5 @@
protobuf>=3.20.2 protobuf>=3.20.2
cython cython
dill
ifnude ifnude
insightface==0.7.3 insightface==0.7.3
onnx>=1.14.0 onnx>=1.14.0

@ -16,7 +16,7 @@ REFERENCE_PATH = os.path.join(
) )
# Defining the version flag for the application # Defining the version flag for the application
VERSION_FLAG: str = "v1.2.5" VERSION_FLAG: str = "v1.2.7"
# Defining the path for 'sd-webui-faceswaplab' inside the 'extensions' directory # Defining the path for 'sd-webui-faceswaplab' inside the 'extensions' directory
EXTENSION_PATH = os.path.join("extensions", "sd-webui-faceswaplab") EXTENSION_PATH = os.path.join("extensions", "sd-webui-faceswaplab")

@ -14,7 +14,6 @@ from scripts.faceswaplab_utils import imgutils
from scripts.faceswaplab_utils.models_utils import get_swap_models from scripts.faceswaplab_utils.models_utils import get_swap_models
import traceback import traceback
import dill as pickle # will be removed in future versions
from scripts.faceswaplab_swapping import swapper from scripts.faceswaplab_swapping import swapper
from pprint import pformat from pprint import pformat
import re import re
@ -174,20 +173,13 @@ def load_face(name: str) -> Optional[Face]:
if filename.endswith(".pkl"): if filename.endswith(".pkl"):
logger.warning( logger.warning(
"Pkl files for faces are deprecated to enhance safety, they will be unsupported in future versions." "Pkl files for faces are deprecated to enhance safety, you need to convert them"
) )
logger.warning("The file will be converted to .safetensors") logger.warning("The file will be converted to .safetensors")
logger.warning( logger.warning(
"You can also use this script https://gist.github.com/glucauze/4a3c458541f2278ad801f6625e5b9d3d" "You can also use this script https://gist.github.com/glucauze/4a3c458541f2278ad801f6625e5b9d3d"
) )
with open(filename, "rb") as file: return None
logger.info("Load pkl")
face = Face(pickle.load(file))
logger.warning(
"Convert to safetensors, you can remove the pkl version once you have ensured that the safetensor is working"
)
save_face(face, filename.replace(".pkl", ".safetensors"))
return face
elif filename.endswith(".safetensors"): elif filename.endswith(".safetensors"):
face = {} face = {}

@ -72,10 +72,16 @@ def get_current_swap_model() -> str:
models = get_swap_models() models = get_swap_models()
model = models[0] if len(models) else None model = models[0] if len(models) else None
logger.info("Try to use model : %s", model) logger.info("Try to use model : %s", model)
try:
if not os.path.isfile(model): # type: ignore if not os.path.isfile(model): # type: ignore
logger.error("The model %s cannot be found or loaded", model) logger.error("The model %s cannot be found or loaded", model)
raise FileNotFoundError( raise FileNotFoundError(
"No faceswap model found. Please add it to the faceswaplab directory." "No faceswap model found. Please add it to the faceswaplab directory."
) )
except:
raise FileNotFoundError(
"Was not able to check model, please ensure the model is in the proper directory"
)
assert model is not None assert model is not None
return model return model

Loading…
Cancel
Save