Browse Source

Search recursively in subfolders for embeddings.

pull/625/head
comfyanonymous 2 years ago
parent
commit
af9cc1fb6a
  1. 9
      comfy/sd1_clip.py

9
comfy/sd1_clip.py

@ -191,11 +191,20 @@ def safe_load_embed_zip(embed_path):
del embed
return out
def expand_directory_list(directories):
dirs = set()
for x in directories:
dirs.add(x)
for root, subdir, file in os.walk(x, followlinks=True):
dirs.add(root)
return list(dirs)
def load_embed(embedding_name, embedding_directory):
if isinstance(embedding_directory, str):
embedding_directory = [embedding_directory]
embedding_directory = expand_directory_list(embedding_directory)
valid_file = None
for embed_dir in embedding_directory:
embed_path = os.path.join(embed_dir, embedding_name)

Loading…
Cancel
Save