mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-13 02:57:06 +08:00
update model tags
This commit is contained in:
parent
e7ae514422
commit
0e2653ad57
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
from comfy_extras.chainner_models import model_loading
|
from comfy_extras.chainner_models import model_loading
|
||||||
from comfy.sd import load_torch_file
|
from comfy.sd import load_torch_file
|
||||||
import model_management
|
import model_management
|
||||||
@ -17,7 +16,7 @@ class UpscaleModelLoader:
|
|||||||
CATEGORY = "loaders"
|
CATEGORY = "loaders"
|
||||||
|
|
||||||
def load_model(self, model_name):
|
def load_model(self, model_name):
|
||||||
model_path = folder_paths.get_full_path("upscale_models", model_name)
|
model_path = folder_paths.get_full_path("upscale_model", model_name)
|
||||||
sd = load_torch_file(model_path)
|
sd = load_torch_file(model_path)
|
||||||
out = model_loading.load_state_dict(sd).eval()
|
out = model_loading.load_state_dict(sd).eval()
|
||||||
return (out, )
|
return (out, )
|
||||||
|
|||||||
@ -62,7 +62,7 @@ def get_filename_list(model_tag):
|
|||||||
|
|
||||||
|
|
||||||
# default model types
|
# default model types
|
||||||
register_model_type('ckpt', supported_ckpt_extensions)
|
register_model_type('checkpoint', supported_ckpt_extensions)
|
||||||
register_model_type('config', ['.yaml'])
|
register_model_type('config', ['.yaml'])
|
||||||
register_model_type('lora', supported_pt_extensions)
|
register_model_type('lora', supported_pt_extensions)
|
||||||
register_model_type('vae', supported_pt_extensions)
|
register_model_type('vae', supported_pt_extensions)
|
||||||
@ -75,7 +75,7 @@ register_model_type('upscale_model', supported_pt_extensions)
|
|||||||
|
|
||||||
# default search paths
|
# default search paths
|
||||||
models_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "models")
|
models_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "models")
|
||||||
add_model_search_path('ckpt', os.path.join(models_dir, "checkpoints"))
|
add_model_search_path('checkpoint', os.path.join(models_dir, "checkpoints"))
|
||||||
add_model_search_path('config', os.path.join(models_dir, "configs"))
|
add_model_search_path('config', os.path.join(models_dir, "configs"))
|
||||||
add_model_search_path('lora', os.path.join(models_dir, "loras"))
|
add_model_search_path('lora', os.path.join(models_dir, "loras"))
|
||||||
add_model_search_path('vae', os.path.join(models_dir, "vae"))
|
add_model_search_path('vae', os.path.join(models_dir, "vae"))
|
||||||
|
|||||||
2
main.py
2
main.py
@ -16,7 +16,7 @@ if __name__ == "__main__":
|
|||||||
print("\t--port 8188\t\t\tSet the listen port.")
|
print("\t--port 8188\t\t\tSet the listen port.")
|
||||||
|
|
||||||
dummy_path = os.path.join('path', 'to', 'dir')
|
dummy_path = os.path.join('path', 'to', 'dir')
|
||||||
print(f"\t--ckpt-dir {dummy_path}\t\t\tAdd a path to a checkpoint directory.")
|
print(f"\t--checkpoint-dir {dummy_path}\t\t\tAdd a path to a checkpoint directory.")
|
||||||
print(f"\t--config-dir {dummy_path}\t\t\tAdd a path to a model config directory.")
|
print(f"\t--config-dir {dummy_path}\t\t\tAdd a path to a model config directory.")
|
||||||
print(f"\t--clip-dir {dummy_path}\t\t\tAdd a path to a clip directory.")
|
print(f"\t--clip-dir {dummy_path}\t\t\tAdd a path to a clip directory.")
|
||||||
print(f"\t--clip-vision-dir {dummy_path}\tAdd a path to a clip vision directory.")
|
print(f"\t--clip-vision-dir {dummy_path}\tAdd a path to a clip vision directory.")
|
||||||
|
|||||||
10
nodes.py
10
nodes.py
@ -198,8 +198,8 @@ class CheckpointLoader:
|
|||||||
CATEGORY = "loaders"
|
CATEGORY = "loaders"
|
||||||
|
|
||||||
def load_checkpoint(self, config_name, ckpt_name, output_vae=True, output_clip=True):
|
def load_checkpoint(self, config_name, ckpt_name, output_vae=True, output_clip=True):
|
||||||
config_path = folder_paths.get_full_path("configs", config_name)
|
config_path = folder_paths.get_full_path("config", config_name)
|
||||||
ckpt_path = folder_paths.get_full_path("checkpoints", ckpt_name)
|
ckpt_path = folder_paths.get_full_path("checkpoint", ckpt_name)
|
||||||
return comfy.sd.load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
return comfy.sd.load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
||||||
|
|
||||||
class CheckpointLoaderSimple:
|
class CheckpointLoaderSimple:
|
||||||
@ -213,7 +213,7 @@ class CheckpointLoaderSimple:
|
|||||||
CATEGORY = "loaders"
|
CATEGORY = "loaders"
|
||||||
|
|
||||||
def load_checkpoint(self, ckpt_name, output_vae=True, output_clip=True):
|
def load_checkpoint(self, ckpt_name, output_vae=True, output_clip=True):
|
||||||
ckpt_path = folder_paths.get_full_path("checkpoints", ckpt_name)
|
ckpt_path = folder_paths.get_full_path("checkpoint", ckpt_name)
|
||||||
out = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
out = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class LoraLoader:
|
|||||||
CATEGORY = "loaders"
|
CATEGORY = "loaders"
|
||||||
|
|
||||||
def load_lora(self, model, clip, lora_name, strength_model, strength_clip):
|
def load_lora(self, model, clip, lora_name, strength_model, strength_clip):
|
||||||
lora_path = folder_paths.get_full_path("loras", lora_name)
|
lora_path = folder_paths.get_full_path("lora", lora_name)
|
||||||
model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora_path, strength_model, strength_clip)
|
model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora_path, strength_model, strength_clip)
|
||||||
return (model_lora, clip_lora)
|
return (model_lora, clip_lora)
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ class StyleModelLoader:
|
|||||||
CATEGORY = "loaders"
|
CATEGORY = "loaders"
|
||||||
|
|
||||||
def load_style_model(self, style_model_name):
|
def load_style_model(self, style_model_name):
|
||||||
style_model_path = folder_paths.get_full_path("style_models", style_model_name)
|
style_model_path = folder_paths.get_full_path("style_model", style_model_name)
|
||||||
style_model = comfy.sd.load_style_model(style_model_path)
|
style_model = comfy.sd.load_style_model(style_model_path)
|
||||||
return (style_model,)
|
return (style_model,)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user