Update preprocessor.py

This commit is contained in:
lllyasviel
2024-01-31 20:49:26 -08:00
parent 6e60e4696f
commit 1a83cc522c

View File

@@ -712,7 +712,7 @@ class InsightFaceModel:
from huggingface mirror.""" from huggingface mirror."""
from modules.modelloader import load_file_from_url from modules.modelloader import load_file_from_url
from modules_forge.shared import models_path from modules_forge.shared import models_path
model_root = os.path.join(models_path, "insightface", 'models', "antelopev2") model_root = os.path.join(models_path, "insightface", "models", "antelopev2")
if not model_root: if not model_root:
os.makedirs(model_root, exist_ok=True) os.makedirs(model_root, exist_ok=True)
for local_file, url in ( for local_file, url in (
@@ -731,11 +731,10 @@ class InsightFaceModel:
if self.model is None: if self.model is None:
from insightface.app import FaceAnalysis from insightface.app import FaceAnalysis
from modules_forge.shared import models_path from modules_forge.shared import models_path
model_root = os.path.join(models_path, "insightface", 'models', "antelopev2")
self.model = FaceAnalysis( self.model = FaceAnalysis(
name=self.face_analysis_model_name, name=self.face_analysis_model_name,
providers=['CUDAExecutionProvider', 'CPUExecutionProvider'], providers=['CUDAExecutionProvider', 'CPUExecutionProvider'],
root=model_root, root=os.path.join(models_path, "insightface"),
) )
self.model.prepare(ctx_id=0, det_size=(640, 640)) self.model.prepare(ctx_id=0, det_size=(640, 640))