Skip to content

Commit

Permalink
Add a command-line argument to enable variants
Browse files Browse the repository at this point in the history
This allows the use of nodes that have sockets of type '*' without
applying a patch to the code.
  • Loading branch information
guill committed Feb 15, 2024
1 parent 2c7145d commit 12627ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions comfy/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class LatentPreviewMethod(enum.Enum):
parser.add_argument("--disable-metadata", action="store_true", help="Disable saving prompt metadata in files.")

parser.add_argument("--multi-user", action="store_true", help="Enables per-user storage.")
parser.add_argument("--enable-variants", action="store_true", help="Enables '*' type nodes.")

if comfy.options.args_parsing:
args = parser.parse_args()
Expand Down
4 changes: 3 additions & 1 deletion execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from comfy.graph import get_input_info, ExecutionList, DynamicPrompt, ExecutionBlocker
from comfy.graph_utils import is_link, GraphBuilder
from comfy.caching import HierarchicalCache, LRUCache, CacheKeySetInputSignature, CacheKeySetInputSignatureWithID, CacheKeySetID
from comfy.cli_args import args

class ExecutionResult(Enum):
SUCCESS = 0
Expand Down Expand Up @@ -550,7 +551,8 @@ def validate_inputs(prompt, item, validated):
o_id = val[0]
o_class_type = prompt[o_id]['class_type']
r = nodes.NODE_CLASS_MAPPINGS[o_class_type].RETURN_TYPES
if r[val[1]] != type_input:
is_variant = args.enable_variants and (r[val[1]] == "*" or type_input == "*")
if r[val[1]] != type_input and not is_variant:
received_type = r[val[1]]
details = f"{x}, {received_type} != {type_input}"
error = {
Expand Down

0 comments on commit 12627ca

Please sign in to comment.