ComfyUI/comfy/cmd/extra_model_paths.py
2024-03-12 09:49:47 -07:00

26 lines
791 B
Python

import os
import yaml
import logging
def load_extra_path_config(yaml_path):
from . import folder_paths
with open(yaml_path, 'r') as stream:
config = yaml.safe_load(stream)
for c in config:
conf = config[c]
if conf is None:
continue
base_path = None
if "base_path" in conf:
base_path = conf.pop("base_path")
for x in conf:
for y in conf[x].split("\n"):
if len(y) == 0:
continue
full_path = y
if base_path is not None:
full_path = os.path.join(base_path, full_path)
logging.info(f"Adding extra search path {x} ({full_path})")
folder_paths.add_model_folder_path(x, full_path)