|
|
|
@ -119,25 +119,8 @@ class ModelMergeBlocks:
|
|
|
|
|
m.add_patches({k: kp[k]}, 1.0 - ratio, ratio) |
|
|
|
|
return (m, ) |
|
|
|
|
|
|
|
|
|
class CheckpointSave: |
|
|
|
|
def __init__(self): |
|
|
|
|
self.output_dir = folder_paths.get_output_directory() |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def INPUT_TYPES(s): |
|
|
|
|
return {"required": { "model": ("MODEL",), |
|
|
|
|
"clip": ("CLIP",), |
|
|
|
|
"vae": ("VAE",), |
|
|
|
|
"filename_prefix": ("STRING", {"default": "checkpoints/ComfyUI"}),}, |
|
|
|
|
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},} |
|
|
|
|
RETURN_TYPES = () |
|
|
|
|
FUNCTION = "save" |
|
|
|
|
OUTPUT_NODE = True |
|
|
|
|
|
|
|
|
|
CATEGORY = "advanced/model_merging" |
|
|
|
|
|
|
|
|
|
def save(self, model, clip, vae, filename_prefix, prompt=None, extra_pnginfo=None): |
|
|
|
|
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) |
|
|
|
|
def save_checkpoint(model, clip=None, vae=None, clip_vision=None, filename_prefix=None, output_dir=None, prompt=None, extra_pnginfo=None): |
|
|
|
|
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, output_dir) |
|
|
|
|
prompt_info = "" |
|
|
|
|
if prompt is not None: |
|
|
|
|
prompt_info = json.dumps(prompt) |
|
|
|
@ -176,7 +159,27 @@ class CheckpointSave:
|
|
|
|
|
output_checkpoint = f"{filename}_{counter:05}_.safetensors" |
|
|
|
|
output_checkpoint = os.path.join(full_output_folder, output_checkpoint) |
|
|
|
|
|
|
|
|
|
comfy.sd.save_checkpoint(output_checkpoint, model, clip, vae, metadata=metadata) |
|
|
|
|
comfy.sd.save_checkpoint(output_checkpoint, model, clip, vae, clip_vision, metadata=metadata) |
|
|
|
|
|
|
|
|
|
class CheckpointSave: |
|
|
|
|
def __init__(self): |
|
|
|
|
self.output_dir = folder_paths.get_output_directory() |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def INPUT_TYPES(s): |
|
|
|
|
return {"required": { "model": ("MODEL",), |
|
|
|
|
"clip": ("CLIP",), |
|
|
|
|
"vae": ("VAE",), |
|
|
|
|
"filename_prefix": ("STRING", {"default": "checkpoints/ComfyUI"}),}, |
|
|
|
|
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},} |
|
|
|
|
RETURN_TYPES = () |
|
|
|
|
FUNCTION = "save" |
|
|
|
|
OUTPUT_NODE = True |
|
|
|
|
|
|
|
|
|
CATEGORY = "advanced/model_merging" |
|
|
|
|
|
|
|
|
|
def save(self, model, clip, vae, filename_prefix, prompt=None, extra_pnginfo=None): |
|
|
|
|
save_checkpoint(model, clip=clip, vae=vae, filename_prefix=filename_prefix, output_dir=self.output_dir, prompt=prompt, extra_pnginfo=extra_pnginfo) |
|
|
|
|
return {} |
|
|
|
|
|
|
|
|
|
class CLIPSave: |
|
|
|
|