Nodes/ComfyUI-mnemic-nodes/πŸ”€ Batch Wildcard Upscale Sampler
ComfyUI Node

πŸ”€ Batch Wildcard Upscale Sampler

Batch Wildcard Upscale Sampler β€” ComfyUI Node Guide

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated 23 days agoΒ· 105
πŸ”€ Batch Wildcard Upscale Sampler
  • model
  • clip
  • vae
  • upscale_model
  • model
  • clip
  • vae
  • positive
  • negative
  • latent
  • prompt
β—„textβ€”β–Ί
β—„negativeβ€”β–Ί
β—„seed0β–Ί
β—„batch_size4β–Ί
β—„width1024β–Ί
β—„height1024β–Ί
β—„steps20β–Ί
β—„cfg7.0β–Ί
β—„sampler_nameβ–Ύβ–Ί
β—„schedulerβ–Ύβ–Ί
β—„denoise1.00β–Ί
β—„upscalefalseβ–Ί
β—„upscale_rate2.00β–Ί
β—„upscale_denoise0.20β–Ί
β—„upscale_steps20β–Ί
β—„upscale_cfg4.0β–Ί
β—„upscale_sampler_nameβ–Ύβ–Ί
β—„upscale_schedulerβ–Ύβ–Ί
β—„upscale_noise_inject_strength0.00β–Ί
β—„strip_prompt_weightsfalseβ–Ί
β—„recache_wildcardsfalseβ–Ί

This is the biggest, most opinionated node in the whole pack, and it solves a real limitation of how ComfyUI batches normally work. A standard batch shares one resolved prompt across every image in it - if your prompt has a wildcard in it, ComfyUI resolves it once and every image in the batch gets the same result. This node resolves wildcards, and any inline LoRA tags, separately for every single image, then runs them one at a time internally and stitches the results back into one batch-shaped output at the end. You get true per-image prompt variation without giving up the convenience of a single batch downstream. The README credits the underlying approach to ChronoKnight's original code, adapted here with LoRA-tag loading and an optional hi-res pass bolted on.

The core trade-off is stated honestly in the tooltip rather than hidden: this is not a true parallel sampler batch. Processing sequentially inside one node is still faster in practice than the obvious alternative - separate nodes per image, manually wired - but it's not the raw-throughput win a native batch gives you. What you're buying is variation, not speed.

The wildcard syntax is the same one A1111 popularized years ago and that a lot of people who came to ComfyUI after 2023 never actually learned: {a|b|c} picks randomly between options, {5::black|green|red} weights the choice (black five times more likely), {2$$a|b|c|d} pulls a specific count of items out instead of one, and __filename__ pulls a random line out of a wildcard text file. <lora:name:strength> tags work inline in the prompt too - fuzzy-matched by filename against your installed LoRAs, auto-stripped before the text reaches CLIP, the same convention as this pack's standalone LoRA Loader Prompt Tags node.

The fields a beginner actually touches: text and negative are your prompts, wildcards and all. seed is the base - image 1 uses seed+0, image 2 uses seed+1, and so on, so the same seed reliably reproduces the same sequence of resolved prompts. batch_size, width, height, steps, cfg, sampler_name, scheduler, and denoise are the standard KSampler set you already know. model and clip are optional - leave them disconnected and you can preview resolved prompts for free, with no sampling and no GPU spend, which is a genuinely useful way to test whether your wildcard combos are producing what you expect before committing compute to them.

The optional hi-res pass is its own small subsystem: flip upscale on and the first-pass latent gets decoded, upscaled, and sampled again at upscale_rate times the original size, with its own upscale_denoise, upscale_steps, upscale_cfg, sampler, and scheduler (each can independently reuse the first pass's setting via a "(same as first pass)" option). This pass needs a vae connected - without one, the tooltip is explicit that the whole upscale step is silently skipped, which is the single easiest way to think you've enabled hi-res and not gotten it. If you connect an upscale_model (a Load Upscale Model node feeding in something like a 4x ESRGAN), it runs the AI upscale first and then downsamples to the exact size your upscale_rate implies - so a 4x model with upscale_rate at 2.0 still lands you a clean 2x result rather than a blown-out 4x one.

strip_prompt_weights deserves a specific callout: it strips (word:1.3)-style attention syntax before encoding, and you want it on for any modern LLM-encoded model family (Flux, SD3-lineage and similar) - those text encoders read prompts as instructions, not as CLIP token soup, so parenthesis-and-colon weighting isn't ignored, it's passed through as literal punctuation and actively hurts your result. Leave it off for CLIP-era checkpoints where weighting still works as intended.

Outputs: model/clip/vae pass through patched with whichever LoRA the last batch item resolved - worth knowing if you're batching four images with four different LoRA tags, because only the last one's patch survives on this output. positive/negative conditioning are likewise from the last item. latent is the actual combined batch you care about, and prompt gives you the resolved text for every item as a list - genuinely useful for auditing which wildcard combination produced which image after the fact.

Where this breaks in practice: a mistyped LoRA name in a tag fails the same way it does everywhere else in the pack - silently, via fuzzy matching that just doesn't find a close enough hit. Forgetting the vae for the upscale pass is the other big one. And running weighted prompt syntax against an LLM-encoded model without strip_prompt_weights on is a subtle one that produces plausible-but-wrong output rather than an obvious error.

Category⚑ MNeMiC Nodes

Inputs (25)

NameTypeDefaultDescription
textSTRINGPositive prompt with full wildcard and <lora:...> support. How this node uses it: - Each image resolves this prompt independently. - Each image can end up with a different final prompt. - Images are processed sequentially inside the node, not as a true sampler batch. Use the same seed to reproduce the same sequence of resolved prompts. File Wildcards: Use __filename__ to insert a random line from filename.txt in one of the supported wildcard directories. Lines starting with # are treated as comments and are ignored. Inline Choices: Use {a|b|c} to randomly choose between a, b, or c. Example Input: A photo of a {red|green|blue} car. Example Output: A photo of a green car. Weighted Choices: Use {5::black|green|red} to make black 5 times more likely to be chosen than green or red. Weights are normalized to 100% based on the sum of all weights in the block (e.g. {5::red|4::green|7::blue|black} sums to 17, giving red ~29%, green ~24%, blue ~41%, black ~6%). Select Multiple Wildcards: Use {2$$a|b|c|d} to output a specific number of items from the result. Example Input: My favorite colors are {3$$red|green|blue|yellow|purple}. Example Output: My favorite colors are blue, yellow, purple. Ranged Select Multiple: Use {1-3$$red|green|blue|yellow|purple} to select a random number of 1-3 items within a range. Custom Separator: Use {1-3$$, $$red|green|blue|yellow|purple} to join the selected items with a custom separator (here, ", ") instead of the default. Variables: Define a variable to reuse a value. Can be defined directly, or using a wildcard Example Input: ${animal=!__animals__} The ${animal} is friends with the other ${animal}. Example Output: The cat is friends with the other cat. LoRAs: Include <lora:name:strength> tags to load LoRAs automatically (no separate LoRA loader node needed). Example: <lora:mylora:0.75> The best matching LoRA file is found by name. Strength is optional (defaults to 1.0); add a second value for a separate CLIP strength, e.g. <lora:mylora:0.8:0.6>. The tag stays in the resolved prompt for metadata and is removed before the text reaches CLIP.
negativeSTRINGNegative prompt. Supports the exact same wildcard syntax as the positive prompt. How this node uses it: - Each image resolves its own negative prompt independently. - Negative prompt wildcards follow the same per-image sequential flow as the positive prompt.
seedINT00–18446744073709550000Base seed for both wildcard resolution and sampling noise. Per-image behavior: - Image 1 uses seed + 0 - Image 2 uses seed + 1 - Image 3 uses seed + 2 Using the same seed and the same prompts reproduces the same sequential run.
batch_sizeINT41–64How many images to generate. Important: - This is not a true sampler batch. - The node runs one image at a time internally. - For each item, it resolves wildcards, encodes prompts, samples, and optionally upscales. The final outputs are then combined into one batch-shaped result for downstream nodes.
widthINT102464–16384β€”
heightINT102464–16384β€”
stepsINT201–10000β€”
cfgFLOAT7.00–100β€”
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
denoiseFLOAT1.000–1β€”
upscaleBOOLEANfalseEnable an upscale second pass: after the first sampling, each image's latent is upscaled and sampled again at the larger resolution. The upscale settings are in the Advanced section.
upscale_rateFLOAT2.001–4Upscale factor. The first-pass latent is upscaled by this much before the second pass (e.g. 2.0 doubles width and height). The slider goes up to 4, but larger values can be typed in. Only used when 'upscale' is on and this is greater than 1. When an upscale model is connected, it runs first (e.g. a 4x ESRGAN), then the result is downscaled to the exact target size implied by upscale_rate β€” so a 4x model with upscale_rate=2.0 gives a clean 2x final.
upscale_denoiseFLOAT0.200–1Denoise strength for the upscale second pass. Lower keeps the first-pass composition but leaves upscale artifacts; higher adds detail but can drift from the original image.
upscale_stepsINT201–10000Steps for the upscale pass.
upscale_cfgFLOAT4.00–100CFG for the upscale pass. 0 = use the same cfg as the first pass.
upscale_sampler_nameCOMBOSampler for the upscale pass. '(same as first pass)' reuses the first-pass sampler.
upscale_schedulerCOMBOScheduler for the upscale pass. '(same as first pass)' reuses the first-pass scheduler.
upscale_noise_inject_strengthFLOAT0.000–1Inject additional Gaussian noise into the upscaled latent before the second-pass sampler runs. 0.0 = no extra noise (default). The actual noise magnitude is strength Γ— Οƒ(scheduler, start_step), so the curve follows the upscale scheduler: e.g. karras front-loads its sigmas and injects more noise at low strength values than a linear schedule would. This adds variation and can break up VAE-encode artifacts before refinement.
strip_prompt_weightsBOOLEANfalseStrip per-token weight syntax from prompts before encoding. Removes patterns like (word:1.3) β€” used for emphasis in older CLIP models β€” leaving just the text (e.g. 'word'). Modern LLM-based text encoders such as T5 (used in FLUX, SD3, and other newer models) process prompts as natural language and do not support ComfyUI/A1111-style prompt weighting. Feeding them weighted syntax causes the encoder to interpret the parentheses and colons as literal characters, which can degrade prompt adherence. Enable this when your model uses an LLM-based text encoder.
recache_wildcardsBOOLEANfalseForce a reload of all wildcard files from disk. Can be disabled again after you have ran it once.
modeloptMODELOptional. Only needed to sample images. Leave disconnected (or leave the latent output unused) to just resolve and preview prompts.
clipoptCLIPOptional. Only needed to sample images. Leave disconnected (or leave the latent output unused) to just resolve and preview prompts.
vaeoptVAEOptional for plain sampling, but REQUIRED for the upscale pass: it decodes the latent to an image, the image is Lanczos-upscaled in pixel space, then re-encoded. Without a VAE the upscale pass is skipped.
upscale_modeloptUPSCALE_MODELOptional. Connect a 'Load Upscale Model' (e.g. an ESRGAN/4x model) to use AI super-resolution for the hi-res upscale instead of plain Lanczos.

Outputs (7)

NameTypeDescription
modelMODELThe model after LoRA patches from the last batch item have been applied.
clipCLIPThe CLIP after LoRA patches from the last batch item have been applied.
vaeVAEThe VAE input passed through for downstream use, including hi-res workflows.
positiveCONDITIONINGThe positive conditioning encoded from the last batch item's prompt.
negativeCONDITIONINGThe negative conditioning encoded from the last batch item's prompt.
latentLATENTThe combined batch of sampled latents (empty when sampling is skipped).
promptSTRINGThe resolved positive prompt for each image, as a list with one entry per batch item.