Skip to content

Insightface extra paths #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import torchvision.transforms.v2 as T
except ImportError:
import torchvision.transforms as T
import logging

def get_clipvision_file(preset):
preset = preset.lower()
Expand Down Expand Up @@ -149,7 +150,15 @@ def insightface_loader(provider):
except ImportError as e:
raise Exception(e)

path = os.path.join(folder_paths.models_dir, "insightface")
if not folder_paths.folder_names_and_paths.get("insightface"):
path = os.path.join(folder_paths.models_dir, "insightface")
else:
folders_insightface=folder_paths.get_folder_paths("insightface")
if len(folders_insightface)>1:
logging.info(f"[IP ADAPTER PLUS] Several insightface folders exist in extra_model_paths.yaml file. Using {folders_insightface[0]}")
path=folders_insightface[0]
else:
path=folders_insightface[0]
model = FaceAnalysis(name="buffalo_l", root=path, providers=[provider + 'ExecutionProvider',])
model.prepare(ctx_id=0, det_size=(640, 640))
return model
Expand Down