Skip to content

Commit b837f38

Browse files
committed
* if_wildcards option defaults now to stop.
* ComfyUI: new wildcards_input. * removed json import since yaml can read them. * more models detected in ComfyUI. * ComfyUI: example workflow.
1 parent 5e3c8cb commit b837f38

File tree

7 files changed

+123
-87
lines changed

7 files changed

+123
-87
lines changed

docs/CONFIG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* **seed**: Connect here the seed used. By default it is -1 (random).
1010
* **pos_prompt**: Connect here the prompt text, or fill it as a widget.
1111
* **neg_prompt**: Connect here the negative prompt text, or fill it as a widget.
12+
* **wc_wildcards_input**: Wildcards definitions (in yaml or json format). Direct input added to the ones found in the wildcards folders. Allows wildcards to be included in the workflow.
1213

1314
Other common settings (see [below](#common-settings)) also appear as inputs or widgets.
1415

ppp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(
121121
self.wil_keep_choices_order = options.get("keep_choices_order", False)
122122
self.wil_choice_separator = options.get("choice_separator", self.DEFAULT_CHOICE_SEPARATOR)
123123
self.wil_ifwildcards = self.IFWILDCARDS_CHOICES(
124-
options.get("if_wildcards", self.IFWILDCARDS_CHOICES.ignore.value)
124+
options.get("if_wildcards", self.IFWILDCARDS_CHOICES.stop.value)
125125
)
126126
# Send to negative options
127127
self.stn_ignore_repeats = options.get("stn_ignore_repeats", True)

ppp_comfyui.py

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# pylint: disable=missing-module-docstring, missing-class-docstring, missing-function-docstring, invalid-name
2-
31
import os
42

53
# pylint: disable=import-error
@@ -48,8 +46,6 @@ def INPUT_TYPES(cls):
4846
"multiline": True,
4947
"default": "",
5048
"dynamicPrompts": False,
51-
"defaultInput": True,
52-
"forceInput": False,
5349
},
5450
),
5551
"neg_prompt": (
@@ -58,8 +54,6 @@ def INPUT_TYPES(cls):
5854
"multiline": True,
5955
"default": "",
6056
"dynamicPrompts": False,
61-
"defaultInput": True,
62-
"forceInput": False,
6357
},
6458
),
6559
},
@@ -77,25 +71,20 @@ def INPUT_TYPES(cls):
7771
{
7872
"default": "",
7973
"placeholder": "full path of the model",
80-
"defaultInput": True,
81-
"forceInput": False,
74+
"dynamicPrompts": False,
8275
},
8376
),
8477
"seed": (
8578
"INT",
8679
{
8780
"default": -1,
88-
"defaultInput": True,
89-
"forceInput": False,
9081
},
9182
),
9283
"debug_level": (
9384
[e.value for e in DEBUG_LEVEL],
9485
{
9586
"default": DEBUG_LEVEL.minimal.value,
9687
"tooltip": "Debug level",
97-
"defaultInput": False,
98-
"forceInput": False,
9988
},
10089
),
10190
"variants_definitions": (
@@ -105,8 +94,7 @@ def INPUT_TYPES(cls):
10594
"multiline": True,
10695
"placeholder": "",
10796
"tooltip": "Definitions for variant models to be recognized based on strings found in the full filename. Format for each line is: 'name(kind)=comma separated list of substrings (case insensitive)' with kind being one of the base model types or not specified",
108-
"defaultInput": False,
109-
"forceInput": False,
97+
"dynamicPrompts": False,
11098
},
11199
),
112100
"wc_process_wildcards": (
@@ -116,35 +104,39 @@ def INPUT_TYPES(cls):
116104
"tooltip": "Process wildcards in the prompt",
117105
"label_on": "Yes",
118106
"label_off": "No",
119-
"defaultInput": False,
120-
"forceInput": False,
121107
},
122108
),
123109
"wc_wildcards_folders": (
124110
"STRING",
125111
{
126112
"default": "",
127113
"tooltip": "Comma separated list of wildcards folders",
128-
"defaultInput": False,
129-
"forceInput": False,
114+
"dynamicPrompts": False,
115+
},
116+
),
117+
"wc_wildcards_input": (
118+
"STRING",
119+
{
120+
"default": "",
121+
"multiline": True,
122+
"placeholder": "wildcards definitions",
123+
"tooltip": "Wildcards definitions in yaml/json format",
124+
"dynamicPrompts": False,
130125
},
131126
),
132127
"wc_if_wildcards": (
133128
[e.value for e in PromptPostProcessor.IFWILDCARDS_CHOICES],
134129
{
135-
"default": PromptPostProcessor.IFWILDCARDS_CHOICES.ignore.value,
130+
"default": PromptPostProcessor.IFWILDCARDS_CHOICES.stop.value,
136131
"tooltip": "How to handle invalid wildcards in the prompt",
137-
"defaultInput": False,
138-
"forceInput": False,
139132
},
140133
),
141134
"wc_choice_separator": (
142135
"STRING",
143136
{
144137
"default": PromptPostProcessor.DEFAULT_CHOICE_SEPARATOR,
145138
"tooltip": "Default separator for selected choices",
146-
"defaultInput": False,
147-
"forceInput": False,
139+
"dynamicPrompts": False,
148140
},
149141
),
150142
"wc_keep_choices_order": (
@@ -154,17 +146,14 @@ def INPUT_TYPES(cls):
154146
"tooltip": "Keep the order of the choices in the prompt",
155147
"label_on": "Yes",
156148
"label_off": "No",
157-
"defaultInput": False,
158-
"forceInput": False,
159149
},
160150
),
161151
"stn_separator": (
162152
"STRING",
163153
{
164154
"default": PromptPostProcessor.DEFAULT_STN_SEPARATOR,
165155
"tooltip": "Separator for the content added to the negative prompt",
166-
"defaultInput": False,
167-
"forceInput": False,
156+
"dynamicPrompts": False,
168157
},
169158
),
170159
"stn_ignore_repeats": (
@@ -174,8 +163,6 @@ def INPUT_TYPES(cls):
174163
"tooltip": "Ignore repeated content added to the negative prompt",
175164
"label_on": "Yes",
176165
"label_off": "No",
177-
"defaultInput": False,
178-
"forceInput": False,
179166
},
180167
),
181168
"cleanup_extra_spaces": (
@@ -185,8 +172,6 @@ def INPUT_TYPES(cls):
185172
"tooltip": "Remove extra spaces",
186173
"label_on": "Yes",
187174
"label_off": "No",
188-
"defaultInput": False,
189-
"forceInput": False,
190175
},
191176
),
192177
"cleanup_empty_constructs": (
@@ -196,8 +181,6 @@ def INPUT_TYPES(cls):
196181
"tooltip": "Remove empty constructs",
197182
"label_on": "Yes",
198183
"label_off": "No",
199-
"defaultInput": False,
200-
"forceInput": False,
201184
},
202185
),
203186
"cleanup_extra_separators": (
@@ -207,8 +190,6 @@ def INPUT_TYPES(cls):
207190
"tooltip": "Remove extra separators",
208191
"label_on": "Yes",
209192
"label_off": "No",
210-
"defaultInput": False,
211-
"forceInput": False,
212193
},
213194
),
214195
"cleanup_extra_separators2": (
@@ -218,8 +199,6 @@ def INPUT_TYPES(cls):
218199
"tooltip": "Remove extra separators (additional cases)",
219200
"label_on": "Yes",
220201
"label_off": "No",
221-
"defaultInput": False,
222-
"forceInput": False,
223202
},
224203
),
225204
"cleanup_breaks": (
@@ -229,8 +208,6 @@ def INPUT_TYPES(cls):
229208
"tooltip": "Cleanup around BREAKs",
230209
"label_on": "Yes",
231210
"label_off": "No",
232-
"defaultInput": False,
233-
"forceInput": False,
234211
},
235212
),
236213
"cleanup_breaks_eol": (
@@ -240,8 +217,6 @@ def INPUT_TYPES(cls):
240217
"tooltip": "Set BREAKs in their own line",
241218
"label_on": "Yes",
242219
"label_off": "No",
243-
"defaultInput": False,
244-
"forceInput": False,
245220
},
246221
),
247222
"cleanup_ands": (
@@ -251,8 +226,6 @@ def INPUT_TYPES(cls):
251226
"tooltip": "Cleanup around ANDs",
252227
"label_on": "Yes",
253228
"label_off": "No",
254-
"defaultInput": False,
255-
"forceInput": False,
256229
},
257230
),
258231
"cleanup_ands_eol": (
@@ -262,8 +235,6 @@ def INPUT_TYPES(cls):
262235
"tooltip": "Set ANDs in their own line",
263236
"label_on": "Yes",
264237
"label_off": "No",
265-
"defaultInput": False,
266-
"forceInput": False,
267238
},
268239
),
269240
"cleanup_extranetwork_tags": (
@@ -273,8 +244,6 @@ def INPUT_TYPES(cls):
273244
"tooltip": "Clean up around extra network tags",
274245
"label_on": "Yes",
275246
"label_off": "No",
276-
"defaultInput": False,
277-
"forceInput": False,
278247
},
279248
),
280249
"cleanup_merge_attention": (
@@ -284,8 +253,6 @@ def INPUT_TYPES(cls):
284253
"tooltip": "Merge nested attention constructs",
285254
"label_on": "Yes",
286255
"label_off": "No",
287-
"defaultInput": False,
288-
"forceInput": False,
289256
},
290257
),
291258
"remove_extranetwork_tags": (
@@ -295,8 +262,6 @@ def INPUT_TYPES(cls):
295262
"tooltip": "Remove extra network tags",
296263
"label_on": "Yes",
297264
"label_off": "No",
298-
"defaultInput": False,
299-
"forceInput": False,
300265
},
301266
),
302267
},
@@ -342,6 +307,7 @@ def IS_CHANGED(
342307
variants_definitions,
343308
wc_process_wildcards,
344309
wc_wildcards_folders,
310+
wc_wildcards_input,
345311
wc_if_wildcards,
346312
wc_choice_separator,
347313
wc_keep_choices_order,
@@ -372,6 +338,7 @@ def IS_CHANGED(
372338
"variants_definitions": variants_definitions,
373339
"process_wildcards": wc_process_wildcards,
374340
"wildcards_folders": wc_wildcards_folders,
341+
"wildcards_input": wc_wildcards_input,
375342
"if_wildcards": wc_if_wildcards,
376343
"choice_separator": wc_choice_separator,
377344
"keep_choices_order": wc_keep_choices_order,
@@ -403,6 +370,7 @@ def process(
403370
variants_definitions,
404371
wc_process_wildcards,
405372
wc_wildcards_folders,
373+
wc_wildcards_input,
406374
wc_if_wildcards,
407375
wc_choice_separator,
408376
wc_keep_choices_order,
@@ -427,23 +395,33 @@ def process(
427395
self.logger.warning("Model class is not provided. System variables might not be properly set.")
428396
if modelname == "":
429397
self.logger.warning("Modelname is not provided. System variables will not be properly set.")
398+
# model class values in ComfyUI\comfy\supported_models.py
430399
env_info = {
431400
"app": "comfyui",
432401
"models_path": folder_paths.models_dir,
433402
"model_filename": modelname or "", # path is relative to checkpoints folder
434403
"model_class": modelclass,
435404
"is_sd1": modelclass in ("SD15", "SD15_instructpix2pix"),
436-
"is_sd2": modelclass in ("SD20", "SD21UnclipL", "SD21UnclipH"),
405+
"is_sd2": modelclass in ("SD20", "SD21UnclipL", "SD21UnclipH", "LotusD"),
437406
"is_sdxl": (
438407
modelclass in ("SDXL", "SDXLRefiner", "SDXL_instructpix2pix", "Segmind_Vega", "KOALA_700M", "KOALA_1B")
439408
),
440409
"is_ssd": modelclass in ("SSD1B",),
441410
"is_sd3": modelclass in ("SD3",),
442411
"is_flux": modelclass in ("Flux", "FluxInpaint", "FluxSchnell"),
443412
"is_auraflow": modelclass in ("AuraFlow",),
413+
"is_pixart": modelclass in ("PixArtAlpha", "PixArtSigma"),
414+
"is_lumina2": modelclass in ("Lumina2",),
415+
"is_ltxv": modelclass in ("LTXV",),
416+
"is_cosmos": modelclass in ("CosmosT2V", "CosmosI2V"),
417+
"is_genmomochi": modelclass in ("GenmoMochi",),
418+
"is_hunyuan": modelclass in ("HunyuanDiT", "HunyuanDiT1"),
419+
"is_hunyuanvideo": modelclass in ("HunyuanVideo", "HunyuanVideoI2V", "HunyuanVideoSkyreelsI2V"),
420+
"is_hunyuan3d": modelclass in ("Hunyuan3Dv2", "Hunyuan3Dv2mini"),
421+
"is_wanvideo": modelclass in ("WAN21_T2V", "WAN21_I2V", "WAN21_FunControl2V"),
422+
"is_hidream": modelclass in ("HiDream",),
444423
}
445-
# Also supported: SVD_img2vid, SVD3D_u, SVD3_p, Stable_Zero123, SD_X4Upscaler,
446-
# Stable_Cascade_C, Stable_Cascade_B, StableAudio, HunyuanDiT, HunyuanDiT1, GenmoMochi, LTXV
424+
# Also supported: SVD_img2vid, SVD3D_u, SVD3_p, Stable_Zero123, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, StableAudio
447425

448426
if wc_wildcards_folders == "":
449427
wc_wildcards_folders = ",".join(folder_paths.get_folder_paths("wildcards") or [])
@@ -477,7 +455,11 @@ def process(
477455
"cleanup_merge_attention": cleanup_merge_attention,
478456
"remove_extranetwork_tags": remove_extranetwork_tags,
479457
}
480-
self.wildcards_obj.refresh_wildcards(debug_level, wildcards_folders if options["process_wildcards"] else None)
458+
self.wildcards_obj.refresh_wildcards(
459+
debug_level,
460+
wildcards_folders if options["process_wildcards"] else None,
461+
wc_wildcards_input,
462+
)
481463
ppp = PromptPostProcessor(
482464
self.logger, self.interrupt, env_info, options, self.grammar_content, self.wildcards_obj
483465
)
@@ -519,8 +501,6 @@ def INPUT_TYPES(cls):
519501
"multiline": False,
520502
"default": "",
521503
"dynamicPrompts": False,
522-
"defaultInput": False,
523-
"forceInput": False,
524504
},
525505
),
526506
},

0 commit comments

Comments
 (0)