mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-09 06:04:31 +08:00
feat: Support customization of the model download path via extra_model_paths.yaml.
example ``` some_extra_path: base_path: /path/to/base download_model_base: models checkpoints: models/checkpoints text_encoders: models/text_encoders vae: models/vae loras: models/loras controlnet: models/controlnet clip_vision: models/clip_vision gligen: models/gligen upscale_models: models/upscale_models embeddings: models/embeddings diffusion_models: models/diffusion_models custom_nodes: custom_nodes is_default: True ```
This commit is contained in:
parent
8aa4fcf448
commit
9e44617199
@ -23,7 +23,7 @@ sys.path.append(glob_path)
|
||||
import cm_global
|
||||
from manager_util import *
|
||||
|
||||
version = [2, 53]
|
||||
version = [2, 54]
|
||||
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
||||
|
||||
|
||||
|
||||
@ -248,23 +248,45 @@ import urllib.request
|
||||
|
||||
|
||||
def get_model_dir(data):
|
||||
if 'download_model_base' in folder_paths.folder_names_and_paths:
|
||||
models_base = folder_paths.folder_names_and_paths['download_model_base'][0][0]
|
||||
else:
|
||||
models_base = folder_paths.models_dir
|
||||
|
||||
def resolve_custom_node(save_path):
|
||||
save_path = save_path[13:] # remove 'custom_nodes/'
|
||||
repo_name = os.path.dirname(save_path) # get custom node repo name
|
||||
repo_path = core.lookup_installed_custom_nodes(repo_name)
|
||||
if repo_path is not None and repo_path[0]:
|
||||
# Returns the retargeted path based on the actually installed repository
|
||||
return os.path.join(os.path.dirname(repo_path[1]), save_path)
|
||||
else:
|
||||
return None
|
||||
|
||||
if data['save_path'] != 'default':
|
||||
if '..' in data['save_path'] or data['save_path'].startswith('/'):
|
||||
print(f"[WARN] '{data['save_path']}' is not allowed path. So it will be saved into 'models/etc'.")
|
||||
base_model = os.path.join(folder_paths.models_dir, "etc")
|
||||
base_model = os.path.join(models_base, "etc")
|
||||
else:
|
||||
if data['save_path'].startswith("custom_nodes"):
|
||||
base_model = os.path.join(core.comfy_path, data['save_path'])
|
||||
base_model = resolve_custom_node(data['save_path'])
|
||||
if base_model is None:
|
||||
print(f"[ComfyUI-Manager] The target custom node for model download is not installed: {data['save_path']}")
|
||||
return None
|
||||
else:
|
||||
base_model = os.path.join(folder_paths.models_dir, data['save_path'])
|
||||
base_model = os.path.join(models_base, data['save_path'])
|
||||
else:
|
||||
model_type = data['type']
|
||||
if model_type == "checkpoints" or model_type == "checkpoint":
|
||||
base_model = folder_paths.folder_names_and_paths["checkpoints"][0][0]
|
||||
elif model_type == "unclip":
|
||||
base_model = folder_paths.folder_names_and_paths["checkpoints"][0][0]
|
||||
elif model_type == "clip":
|
||||
base_model = folder_paths.folder_names_and_paths["clip"][0][0]
|
||||
elif model_type == "clip" or model_type == "text_encoders":
|
||||
if folder_paths.folder_names_and_paths.get("text_encoders"):
|
||||
base_model = folder_paths.folder_names_and_paths["text_encoders"][0][0]
|
||||
else:
|
||||
print(f"[ComfyUI-Manager] Your ComfyUI is outdated version.")
|
||||
base_model = folder_paths.folder_names_and_paths["clip"][0][0] # outdated version
|
||||
elif model_type == "VAE":
|
||||
base_model = folder_paths.folder_names_and_paths["vae"][0][0]
|
||||
elif model_type == "lora":
|
||||
@ -290,14 +312,17 @@ def get_model_dir(data):
|
||||
print(f"[ComfyUI-Manager] Your ComfyUI is outdated version.")
|
||||
base_model = folder_paths.folder_names_and_paths["unet"][0][0] # outdated version
|
||||
else:
|
||||
base_model = os.path.join(folder_paths.models_dir, "etc")
|
||||
base_model = os.path.join(models_base, "etc")
|
||||
|
||||
return base_model
|
||||
|
||||
|
||||
def get_model_path(data):
|
||||
base_model = get_model_dir(data)
|
||||
return os.path.join(base_model, data['filename'])
|
||||
if base_model is None:
|
||||
return None
|
||||
else:
|
||||
return os.path.join(base_model, data['filename'])
|
||||
|
||||
|
||||
def check_custom_nodes_installed(json_obj, do_fetch=False, do_update_check=True, do_update=False):
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-manager"
|
||||
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||
version = "2.53"
|
||||
version = "2.54"
|
||||
license = { file = "LICENSE.txt" }
|
||||
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user