Adjusted all workflows. Added a lot of placeholder files for v3.

This commit is contained in:
Shanoah Alkire
2025-10-15 14:43:52 -07:00
parent e5dba19e77
commit fa6227b09d
19 changed files with 353 additions and 10 deletions
+2
View File
@@ -7,6 +7,8 @@ import logging
# Set to 1 for v1 nodes, 3 for v3 nodes.
# Right now, v3 nodes aren't ready for use.
CURRENT_NODE_VERSION = '1'
# CURRENT_NODE_VERSION = '3'
NODE_VERSION = os.environ.get('SAGEUTILS_NODE_VERSION', CURRENT_NODE_VERSION)
SAGEUTILS_PRINT_TIMING = False # Set to True to enable timing report
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+47
View File
@@ -0,0 +1,47 @@
# Image nodes.
# This includes nodes involving loading, saving, and manipulating images and latents.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
import comfy
import nodes
from comfy_extras.nodes_images import ImageCrop
# Import specific utilities instead of wildcard import
from ..utils import load_image_from_path
import torch
import torch.nn.functional as F
import numpy as np
from PIL import Image
from PIL.PngImagePlugin import PngInfo
import pathlib
import hashlib
import json
import folder_paths
import os
import comfy.model_management
import comfy.utils
import comfy.cli_args
from ..utils.common import get_files_in_dir
import datetime
import logging
# Nodes to implement:
# Sage_EmptyLatentImagePassthrough
# Sage_LoadImage
# Sage_SaveImageWithMetadata
# Sage_CropImage
# Sage_QuickResPicker
# Sage_CubiqImageResize
# Sage_ReferenceImage
IMAGE_NODES = []
+59
View File
@@ -0,0 +1,59 @@
# This file contains nodes for working with LLMs.
# The llm_prompts.json file contains prompts that can be used with LLMs.
# The original source of some of these prompts is the ComfyUI-joycaption-beta-one-GGUF repository,
# which adapted it from ComfyUI_LayerStyle_Advance.
# I've heavily modified the original prompts, adding some, getting rid of some, and rephrasing others.
# https://github.com/chflame163/ComfyUI_LayerStyle_Advance
# https://github.com/judian17/ComfyUI-joycaption-beta-one-GGUF
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
# Import specific utilities instead of wildcard import
from ..utils.config_manager import llm_prompts
from ..utils import llm_wrapper as llm
from ..utils.performance_fix import (
get_cached_ollama_models_for_input_types,
get_cached_lmstudio_models_for_input_types,
get_cached_ollama_vision_models_for_input_types,
get_cached_lmstudio_vision_models_for_input_types
)
# Attempt to import ollama, if available. Set a flag if it is not available.
try:
import ollama
OLLAMA_AVAILABLE = True
except ImportError:
OLLAMA_AVAILABLE = False
# Default vision prompt for LLMs.
DEFAULT_VISION_PROMPT = "Write a detailed description for this image. Use precise, unambiguous language. Avoid vague or general terms. This is going to be used as input for an AI image generator, so do not include anything other than the description, and do not break things into sections or use markdown."
# Default text prompt for LLMs.
DEFAULT_TEXT_PROMPT = "Write a detailed and coherent description of an image based on the provided list of tags."
import logging
# Nodes to implement:
# Sage_ConstructLLMPrompt
# Sage_ConstructLLMPromptExtra
# Sage_OllamaAdvancedOptions
# Sage_OllamaLLMPromptText
# Sage_OllamaLLMPromptVision
# Sage_OllamaLLMPromptVisionRefine
# Sage_LMStudioLLMPromptText
# Sage_LMStudioLLMPromptVision
# Sage_LMStudioLLMPromptVisionRefine
LLM_NODES = []
+46
View File
@@ -0,0 +1,46 @@
# Model v3 nodes.
# This contains nodes involving models. Primarily loading models, but also includes nodes for model info and cache maintenance.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
from ..utils.helpers import pull_metadata, update_model_timestamp, pull_and_update_model_timestamp
# Import specific utilities instead of wildcard import
from ..utils import get_lora_stack_keywords
from ..utils import model_info as mi
from ..utils.helpers_graph import (
add_ckpt_node_from_info,
add_unet_node_from_info,
add_clip_node_from_info,
add_vae_node_from_info,
create_lora_nodes,
create_lora_nodes_model_only,
create_lora_nodes_v2,
create_model_shift_nodes,
create_model_shift_nodes_v2
)
from comfy_execution.graph_utils import GraphBuilder
import folder_paths
import logging
# Nodes to implement
# Sage_UNETLoaderFromInfo
# Sage_ClipLoaderFromInfo
# Sage_ChromaCLIPLoaderFromInfo
# Sage_VAELoaderFromInfo
# Sage_LoadModelFromInfo
# Sage_LoraStackLoader
# Sage_ModelLoraStackLoader
# Sage_UNETLoRALoader
MODEL_NODES = []
+34
View File
@@ -0,0 +1,34 @@
# Metadata v3 nodes.
# Metadata nodes for constructing A1111-style metadata.
# This module includes nodes for constructing metadata and related nodes.
# Saving metadata is handled in the image nodes.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
from pathlib import Path
import json
from typing import Optional
import folder_paths
from comfy.comfy_types.node_typing import ComfyNodeABC, IO
from ..utils import (
lora_to_prompt, civitai_sampler_name,pull_metadata, get_model_dict, cache,
)
from ..utils.model_info import collect_resource_hashes, model_name_and_hash_as_str, _get_model_name_from_info, _get_model_hash_from_info
from ..utils.config_manager import metadata_templates
# Nodes to implement:
# Sage_ConstructMetadataFlexible
METADATA_NODES = []
+29
View File
@@ -0,0 +1,29 @@
# Sampler v3 nodes.
# This is for any nodes involving samplers, currently KSampler and the sampler info nodes.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
import torch
import comfy
import nodes
# Nodes to implement:
# Sage_SamplerSelector
# Sage_SchedulerSelector
# Sage_SamplerInfo
# Sage_AdvSamplerInfo
# Sage_TilingInfo
# Sage_KSampler
# Sage_KSamplerTiledDecoder
# Sage_KSamplerAudioDecoder
SAMPLER_NODES = []
+1 -1
View File
@@ -223,7 +223,7 @@ class Sage_MultiSelectorDoubleClip(ComfyNodeABC):
"weight_dtype": (mi.weight_dtype_options, {"default": "default", "tooltip": "The weight dtype to use for the UNET model."}),
"clip_name_1": (model_list, {"tooltip": "The name of the first CLIP model to load."}),
"clip_name_2": (model_list, {"tooltip": "The name of the second CLIP model to load."}),
"clip_type": (mi.single_clip_loader_options, {"default": "chroma", "tooltip": "The type of the second CLIP model. If empty, will use the default type."}),
"clip_type": (mi.dual_clip_loader_options, {"default": "flux", "tooltip": "The type of the second CLIP model. If empty, will use the default type."}),
"vae_name": (vae_list, {"tooltip": "The name of the VAE model to load."}),
}
}
+50
View File
@@ -0,0 +1,50 @@
# Selector v3 nodes.
# This contains nodes for selecting model information without loading the actual models.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
import folder_paths
from ..utils import model_info as mi
from comfy_execution.graph_utils import GraphBuilder
from ..utils import add_lora_to_stack
from ..utils import get_model_list
from ..utils.helpers_graph import (
add_lora_stack_node
)
import logging
# Nodes to implement:
# Sage_CheckpointSelector
# Sage_UNETSelector
# Sage_VAESelector
# Sage_CLIPSelector
# Sage_DualCLIPSelector
# Sage_TripleCLIPSelector
# Sage_QuadCLIPSelector
# Sage_MultiSelectorSingleClip
# Sage_MultiSelectorDoubleClip
# Sage_MultiSelectorTripleClip
# Sage_MultiSelectorQuadClip
# Sage_ModelShifts
# Sage_ModelShiftOnly
# Sage_FreeU2
# Sage_UnetClipVaeToModelInfo
# Sage_LoraStack
# Sage_QuickLoraStack
# Sage_TripleLoraStack
# Sage_TripleQuickLoraStack
# Sage_QuickSixLoraStack
# Sage_QuickNineLoraStack
# Sage_SixLoraStack
SELECTOR_NODES = []
+31
View File
@@ -0,0 +1,31 @@
# Util nodes v3
# This is for any misc utility nodes that don't fit into the other categories.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
from comfy.utils import ProgressBar
import folder_paths
import logging
import torch
import numpy as np
from PIL import Image
import pathlib
import os
import node_helpers
# Nodes to implement:
# Sage_LoadImageTextSetFromFolderNode
# Sage_Load_Dataset_From_Folder
# Sage_TrainingCaptionsToConditioning
TRAINING_NODES = []
+34
View File
@@ -0,0 +1,34 @@
# Util nodes v3
# This is for any misc utility nodes that don't fit into the other categories.
# See ref_docs/v3_migration.md for info on migrating to v3 nodes.
from __future__ import annotations
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
from comfy_api.latest import io, ComfyExtension
from typing_extensions import override
from comfy_api.latest._io import NodeOutput, Schema
from comfy_execution.graph_utils import GraphBuilder
from comfy_execution.graph import ExecutionBlocker
from comfy.utils import ProgressBar
import folder_paths
import logging
# Nodes to implement:
# Sage_FreeMemory
# Sage_Halt
# Sage_LogicalSwitch
# Sage_ModelInfo
# Sage_ModelInfoDisplay
# Sage_LoraStackInfoDisplay
# Sage_LastLoraInfo
# Sage_GetFileHash
# Sage_CacheMaintenance
# Sage_ModelReport
# Sage_MultiModelPicker
# Sage_CollectKeywordsFromLoraStack
# Sage_CheckLorasForUpdates
UTIL_NODES = []
+12 -1
View File
@@ -7,10 +7,21 @@ from typing_extensions import override
from .utils.performance_timer import log_init
from .nodes.conditioning_v3 import *
from .nodes.image_v3 import *
from .nodes.llm_v3 import *
from .nodes.loader_v3 import *
from .nodes.metadata_v3 import *
from .nodes.sampler_v3 import *
from .nodes.selector_v3 import *
from .nodes.text_v3 import *
from .nodes.training_v3 import *
from .nodes.util_v3 import *
NODE_LIST = []
NODE_LIST = NODE_LIST + TEXT_NODES + CONDITIONING_NODES
NODE_LIST = NODE_LIST + TEXT_NODES + CONDITIONING_NODES + LLM_NODES + IMAGE_NODES + \
MODEL_NODES + METADATA_NODES + SELECTOR_NODES + TRAINING_NODES + UTIL_NODES + \
SAMPLER_NODES
class SageExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]: