[feat] determin model path
Describe the problem
Thought, i'm going to ask...
there are some custom nodes out there, who obviously cloned parts of your ComfyUI_MTB. though, instead of leaning on the global 'extra_model_path.yaml' available in ComfyUI, some at least go and have their own config.yaml to configure another, probably 'centralized', model repo like i did for 'controlnet-aux' or 'tbox' getting now: [ComfyUI-controlnet-aux] | INFO -> Using ckpts path: D:\ComfyUI_Main_Model_Repo\models\annotator and: Home is here: D:\ComfyUI\ComfyUI_windows_portable2\ComfyUI\custom_nodes\ComfyUI-TBox Using ckpts path: D:\ComfyUI_Main_Model_Repo\models\annotator
Thanks
Describe the solution you'd like
Since you obviously check the extra_model_path.yaml, i'm getting [ComfyUI-MTB] | INFO -> Found multiple match, we will pick the last D:\ComfyUI\ComfyUI_windows_portable2\ComfyUI\models\upscale_models ['D:\ComfyUI_Main_Model_Repo\models\upscale_models', 'D:\ComfyUI\ComfyUI_windows_portable2\ComfyUI\models\upscale_models']
BUT: why do you not use it then first? i mean, i'm not sure if you check 2nd as well, if there is no model in the local folder? and where would downloads go? if a custom nodes pack requests a model to download it will usually store it into its first place, which would be exactly the problem here as it should use for working and downloading the prefered folder which is configured by the yaml file....
Alternatives considered
have also some solution as like an own config.yaml to define the model path
Additional context
No response
@melMass
i went for the following changes in utils.py line 1155 onwards...
def get_model_path(fam, model=None):
log.debug(f"Requesting {fam} with model {model}")
res = None
if model:
res = folder_paths.get_full_path(fam, model)
else:
# this one can raise errors...
with contextlib.suppress(KeyError):
res = folder_paths.get_folder_paths(fam)
if res:
if isinstance(res, list):
if len(res) > 1:
# warn_msg = f"Found multiple match, we will pick the \033[96mfirst {res[0]}\033[36;20m\n{res}" # Changed from res[-1] to res[0]
warn_msg = f"Found multiple match, we will pick the first \033[96m{res[0]}\033[0m" # Changed from res[-1] to res[0] and stripped the logged path
if warn_msg not in warned_messages:
log.info(warn_msg)
log.info(res) # log the full paths separately
warned_messages.add(warn_msg)
res = res[0] # Changed from res[-1] to res[0]
res = Path(res)
log.debug(f"Resolved model path from folder_paths: {res}")
else:
res = models_dir / fam
if model:
res /= model
return res
Thanks
Thanks for the report, I'll address this asap, in the weekend. Closing #262 in favor of this one