|
|
|
@ -14,7 +14,6 @@ from scripts.faceswaplab_utils import imgutils
|
|
|
|
|
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
|
|
|
|
@ -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 = {}
|
|
|
|
|