Nodes Browser
ComfyDeploy: How DarkPrompts works in ComfyUI?
What is DarkPrompts?
Slightly better random prompt generation tools that allow combining and picking prompts from both file and text input sources.
How to install it in ComfyDeploy?
Head over to the machine page
- Click on the "Create a new machine" button
- Select the
Edit
build steps - Add a new step -> Custom Node
- Search for
DarkPrompts
and select it - Close the build step dialig and then click on the "Save" button to rebuild the machine
DarkPrompts
A slightly better tool for generating random prompts.
Changelog
DarkPrompt
DarkPrompt reads lines from a file and/or a text input, combines them together, optionally strips out comments and blank lines, and then selects a random line for use in generating your prompt based on a seed input.
It also has a prefix
and suffix
field so you can easily include additional information with each prompt or wrap it inside a weight. For example a prefix of (
and a suffix of :1.2)
could return a string:
(walking a dog:1.2)
from an file named activities.txt
that contains a line walking a dog
. There are additional options for randomly disabling a DarkPrompt object from returning anything. This is useful when you might
have a section of prompting that you only occasionally want to include. For example, you might have different types of shoes you want to add to your character, but occasionally you want the prompt to not mention shoes at all.
Unlike several other ComfyUI projects, the box is somewhat more compact, gives you an easy way to combine file and text sources for prompt generation, and most importantly it re-reads the files after every prompt generation so you don't have to restart ComfyUI after editing wildcard files.
DarkCombiner
DarkCombiner accepts up to 7 text inputs and combines them with an optional delimiter (\n
by default) with a string output. This allows you to easily combine multiple DarkPrompt nodes to generate complex prompts.
It isn't really needed anymore since DarkPrompt supports combining from previous DarkPrompt nodes.
DarkLoraTagLoader
DarkLoraTagLoader is a modified version of [LoraTagLoader(https://github.com/badjeff/comfyui_lora_tag_loader)] that also outputs a LORA_STACK of detected LoRAs for use in things like the Efficient Loader for doing XY Plots. LoraTagLoader is licensed under the freedom-hating GPL v3 license which is why the code for DarkLoraTagLoader is under the gplv3 folder and is licensed separately from other files in this project. It also allows for adjusting LoRA weights.
DarkFaceIndexShuffle
ComfyUI-Reactor-Node supports swapping faces by providing a CSV index of faces (i.e. "0,1,2,3,4,5"). DarkFaceIndexShuffle allows you to enter an array of faces, shuffle the array based on a seed, and stick the result into the Reactor input_faces_index input. This allows you to randomize faces and the order of friends in the scene generated by your prompts.
DarkAnyToString
MTB Any To String broke recently for me. Implemented my own AnyToString.
DarkCheckpointRandomizer
Allows you to provide a text-based list of checkpoints (one per line) to be randomly chosen on each generation. You can optionally specify how many iterations to use the checkpoint for. For example you can specify:
sdXL_v10.safetensors
albedobaseXL_v21.safetensors
...in your list and use_for_iterations
to 5. DarkCheckpointRandomizer would pick one of them at random and continue using it for 5 generations. Then it would pick another one at random.
DarkCheckpointRandomizer will automatically weed out blank lines and checkpoints that don't exist. Checkpoints that don't exist are logged to the console.
DarkFolder
DarkFolder is used to dynamically generate folder paths for saving images. Having a huge output directory with tons of files makes sorting images a huge pain. Sure, some people use a date-prefix to create folders, but in any given day you could have thousands or tens of thousands of images. That's still painful to sort through. DarkFolder works with nodes like 'Save Image w/ Metadata' (From comfy-image-saver) that have a path option for saving images.
DarkFolder takes a prefix (batch-
by default) and a folder_size
and dynamically generates a new path based on the number of images in existing folders.
Additionally there is a selection_method
for choosing how to handle existing folders.
Let's say every time you run a batch on ComfyUI you end up with 8 new images, and you have DarkFolder set to a size of 16 with the selection method set to Highest Not Full
.
On the first run, it would create a folder called batch-0
and toss the 8 newly generated images into it.
On the second run, since batch-0
only has 8 images and the highest "not-full" folder is batch-0
it will drop the next 8 images in there.
On the third run, batch-0
has 16 images. Since folder_size
is set to 16, DarkFolder will tell your image saver to use a new folder called batch-1
until it has 16 or more images in it.
The selection methods:
Fill Gaps: This will search through any existing folders starting with 0. Once it finds a folder with less than $folder_size images in it, it saves there.
Highest Not Full: Regardless of how many folders you have (some could be empty because you've been sorting/deleting), it will find the highest numbered folder that actually contains images
New Every Generation: This basically ignores $folder_size and just creates a new folder every generation
Screenshot
Installation Using ComfyUI Manager
DarkPrompts should now show up in the list of modules in ComfyUI Manager. If not, you can copy the URL of this repo and paste it into the "Install via Git URL" box and restart ComfyUI.
Installation into ComfyUI
Go into your custom_nodes directory and run a git clone https://github.com/darkpixel/darkprompts.git
and then restart ComfyUI.