π Batch Wildcard Upscale Sampler
The wildcard sampler that rolls per image
- model
- clip
- vae
- upscale_model
- model
- clip
- vae
- positive
- negative
- latent
- prompt
A normal KSampler takes one prompt and applies it to the whole batch. So A photo of a {red|green|blue} car with batch size 4 gives you four images of the same color, because the wildcard resolved once. The π Batch Wildcard Upscale Sampler resolves the prompt separately for every index, so one queue gives you four genuinely different prompts - and four different images - from one text box. It also reads <lora:name:strength> tags straight out of the prompt, and it can run a hires-fix second pass. Wildcard text with {a|b|c} is old A1111 syntax, and it's the cheapest way to get variety out of a single graph.
It's adapted from ChronoKnight's original node, which is worth mentioning because the author says so plainly in the README.
How it actually works
Here's the honest bit the README leads with: the name is a bit of a lie. ComfyUI requires conditioning tensors to have a batch dimension of 1, which is exactly why you can't normally give each image its own prompt. So this node doesn't batch - it loops internally, one image at a time:
- Resolve wildcards for index
i(usingseed + i, so it stays reproducible). - Apply any LoRA tags found in that resolved prompt to a clone of model and CLIP.
- Encode positive/negative through CLIP with the
<lora:...>tags stripped out of the text. - Sample one image with seed
seed + i. - Optionally run the upscale pass.
- Repeat, then concatenate everything into one batch-shaped output.
You get convenience and some speedup from staying inside one node, not true batched sampling. On a big batch it is not the fastest option - it's the most varied one.
Inputs you'll actually touch
text and negative are the prompts, with the full wildcard syntax: __file__ for file wildcards, {a|b|c} inline choices, {5::black|green|red} weighted picks, {2$$a|b|c} multi-select, ${var=!__animals__} variables. seed drives both resolution and noise, batch_size (1-64) is how many images, then the usual steps, cfg, sampler_name, scheduler, denoise, width, height.
The Advanced section holds upscale_rate, upscale_denoise, upscale_steps, upscale_cfg, plus strip_prompt_weights and recache_wildcards. Two of those are worth calling out:
strip_prompt_weights- turn this on for T5-based encoders (Flux, SD3 and friends). Those models read prompts as natural language and treat(word:1.3)as literal punctuation, which degrades adherence rather than emphasizing anything.recache_wildcards- you edited a wildcard file and the node is still serving the old lines. Flip it on, run once, flip it off.
model, clip, vae and upscale_model are optional. Here's the genuinely clever part: leave model/clip disconnected and the node skips sampling entirely and just hands you the resolved prompts on its prompt output. It's a wildcard debugger that happens to also be a sampler. The same skip happens if the latent output isn't connected to anything.
The upscale pass
Enable upscale and each image gets the A1111-style hires fix: decode the latent, upscale in pixel space, re-encode, sample again at low denoise. This is the two-pass routine that's still the correct answer for generating above native resolution - low denoise keeps the composition while adding coherent detail. Connect a 4x ESRGAN model via upscale_model and it runs at native scale first, then gets scaled down to whatever upscale_rate asks for, so a 4x model at rate 2.0 gives you a clean 2x instead of a double-upscale.
upscale_denoise defaults to 0.2, which is conservative - conservative is right here. Push past 0.5 and you're re-rolling the image, not refining it. A VAE is mandatory for this pass; without one the node prints a warning and silently skips the upscale.
Outputs, and the one gotcha
latent is the combined batch - decode it. prompt is a list, one resolved prompt per image, which is what you wire into a Show Text node or the positive_override input of πΎ Save Image With Metadata. That saver also auto-detects this node in the graph and writes each image its own prompt and seed without any wiring.
The gotcha: model, clip, positive and negative all reflect the last batch item only. They're for chaining downstream, not for inspecting per-image data.
Install
ComfyUI Manager β search ComfyUI-mnemic-nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
Restart after. No model downloads for this node itself. Console logging moved out of the node into ComfyUI's settings, under β‘MNeMiC Nodes β Wildcard Processing / LoRA Loading, so if you want to see every resolution step, go turn it on there.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Positive 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. | |
| negative | STRING | Negative 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. | |
| seed | INT | 00β18446744073709550000 | Base 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_size | INT | 41β64 | How 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. |
| width | INT | 102464β16384 | Width of each generated image, in pixels. |
| height | INT | 102464β16384 | Height of each generated image, in pixels. |
| steps | INT | 201β10000 | Sampling steps for the first pass. |
| cfg | FLOAT | 7.00β100 | Classifier-free guidance scale for the first pass. Higher follows the prompt more literally. |
| sampler_name | COMBO | Sampler used for the first pass. | |
| scheduler | COMBO | Sigma schedule used for the first pass. | |
| denoise | FLOAT | 1.000β1 | Denoise strength for the first pass. 1.0 generates from pure noise. |
| upscale | BOOLEAN | false | Enable 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_rate | FLOAT | 2.001β4 | Upscale 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_denoise | FLOAT | 0.200β1 | Denoise 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_steps | INT | 201β10000 | Steps for the upscale pass. |
| upscale_cfg | FLOAT | 4.00β100 | CFG for the upscale pass. 0 = use the same cfg as the first pass. |
| upscale_sampler_name | COMBO | Sampler for the upscale pass. '(same as first pass)' reuses the first-pass sampler. | |
| upscale_scheduler | COMBO | Scheduler for the upscale pass. '(same as first pass)' reuses the first-pass scheduler. | |
| upscale_noise_inject_strength | FLOAT | 0.000β1 | Inject 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_weights | BOOLEAN | false | Strip 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_wildcards | BOOLEAN | false | Force a reload of all wildcard files from disk. Can be disabled again after you have ran it once. |
| modelopt | MODEL | Optional. Only needed to sample images. Leave disconnected (or leave the latent output unused) to just resolve and preview prompts. | |
| clipopt | CLIP | Optional. Only needed to sample images. Leave disconnected (or leave the latent output unused) to just resolve and preview prompts. | |
| vaeopt | VAE | Optional 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_modelopt | UPSCALE_MODEL | Optional. 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)
| Name | Type | Description |
|---|---|---|
| model | MODEL | The model after LoRA patches from the last batch item have been applied. |
| clip | CLIP | The CLIP after LoRA patches from the last batch item have been applied. |
| vae | VAE | The VAE input passed through for downstream use, including hi-res workflows. |
| positive | CONDITIONING | The positive conditioning encoded from the last batch item's prompt. |
| negative | CONDITIONING | The negative conditioning encoded from the last batch item's prompt. |
| latent | LATENT | The combined batch of sampled latents (empty when sampling is skipped). |
| prompt | STRING | The resolved positive prompt for each image, as a list with one entry per batch item. |