Skip to content

Commit

Permalink
v1.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
glucauze committed Sep 9, 2023
1 parent bf8ef5e commit c94d2aa
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
10 changes: 8 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,11 @@ def is_installed(package: str) -> bool:

import timeit

check_time = timeit.timeit(check_install, number=1)
print(check_time)
try:
check_time = timeit.timeit(check_install, number=1)
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 change: 0 additions & 1 deletion requirements-gpu.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cython
dill
ifnude
insightface==0.7.3
onnx>=1.14.0
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
protobuf>=3.20.2
cython
dill
ifnude
insightface==0.7.3
onnx>=1.14.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/faceswaplab_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

# 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
EXTENSION_PATH = os.path.join("extensions", "sd-webui-faceswaplab")

Expand Down
12 changes: 2 additions & 10 deletions scripts/faceswaplab_swapping/face_checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from scripts.faceswaplab_utils.models_utils import get_swap_models
import traceback

import dill as pickle # will be removed in future versions
from scripts.faceswaplab_swapping import swapper
from pprint import pformat
import re
Expand Down Expand Up @@ -174,20 +173,13 @@ def load_face(name: str) -> Optional[Face]:

if filename.endswith(".pkl"):
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(
"You can also use this script https://gist.github.com/glucauze/4a3c458541f2278ad801f6625e5b9d3d"
)
with open(filename, "rb") as file:
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
return None

elif filename.endswith(".safetensors"):
face = {}
Expand Down
12 changes: 9 additions & 3 deletions scripts/faceswaplab_utils/models_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ def get_current_swap_model() -> str:
models = get_swap_models()
model = models[0] if len(models) else None
logger.info("Try to use model : %s", model)
if not os.path.isfile(model): # type: ignore
logger.error("The model %s cannot be found or loaded", model)
try:
if not os.path.isfile(model): # type: ignore
logger.error("The model %s cannot be found or loaded", model)
raise FileNotFoundError(
"No faceswap model found. Please add it to the faceswaplab directory."
)
except:
raise FileNotFoundError(
"No faceswap model found. Please add it to the faceswaplab directory."
"Was not able to check model, please ensure the model is in the proper directory"
)

assert model is not None
return model

0 comments on commit c94d2aa

Please sign in to comment.