2024-05-17 01:40:42 +02:00
2024-05-15 21:30:39 +02:00
2024-05-10 23:00:14 +02:00
2024-05-12 02:40:00 +02:00
2024-01-28 18:30:36 +01:00
2024-05-12 13:36:56 +02:00
2024-05-06 14:26:48 +02:00
2024-05-13 18:58:23 +02:00
2024-05-17 01:40:42 +02:00
2024-05-10 15:05:38 +02:00
2024-05-14 20:49:16 +02:00

sn0w-scripts

A collection of nodes and improvements created for general ease and testing loras. These are just nodes I made and found useful, they should work with most other nodes. Most nodes that take in a prompt are made with booru tags in mind and might not work as expected with other prompts.

Get Started

Install

  1. Install ComfyUi.
  2. Clone this repo into custom_nodes:
    git clone https://github.com/sn0w12/ComfyUI-Sn0w-Scripts
    
  3. Start up ComfyUI.

Configuration

In the ComfyUI settings, you can modify various settings. Some changes will apply immediately, while others require a refresh to take effect.

Important Note

Many of the nodes require these paths to be in your extra_model_paths.yaml (with your real directories of course).

loras:
    base_path: D:/Ai/Lora/loras

    loras_xl: /XL
    loras_15: /1.5

Nodes

Image Processing

Nodes that are specifically for generating and processing images.

Simple Sampler Custom

Ksampler with more settings and optional inputs. Support for custom schedulers

ℹ️ See More Information
  • Can take both text and conditioning as positive and negative input.
  • Can take a latent image or can generate one if none is provided.
  • Supports schedulers such as align your steps, you can also create your own scheduler in src/custom_schedulers/, make sure to follow the example provided in get_sigmas_sigmoid.py.
  • You can also just get the sigmas from any of the scheduler nodes and drag them into sigmas (optional), if you do the scheduler widget will not be used.

Simple Sampler

Lora Tester

Automatically generates X amount of images with provided loras.

ℹ️ See More Information
  • I recommend making lora_info and add_default_generation inputs and using the outputs from the Lora Selector.
  • Takes normal KSampler input but takes positive and negative inputs as text.
  • Outputs a batch of images.

Lora Tester

Lora Management

Nodes that handle lora selection, stacking, and loading.

Lora Selector

Automatically selects X amount of loras between two numbers.

ℹ️ See More Information
  • Loras have to be formatted like the default kohya_ss outputs. (lora_name-000001)
  • Select the first lora.
  • Select the number of the highest lora you want to test.
  • Select the amount of loras you want to test.
  • Outputs list of loras like this: <lora:name:strength>
  • Add default generation adds an extra "nothing" at the end of the list, used in Lora Tester to generate an image without the lora.

Lora Selector

Lora Stacker

Outputs a list of loras for Lora Tester. Does not load any loras by itself.

ℹ️ See More Information
  • Basically Lora Selector but manual.
  • Specifically for the lora testers.

Lora Stacker

Load Lora XL/1.5

Normal load lora but from another folder.

ℹ️ See More Information
  • Add these to your extra_model_paths.yaml (for example):
  • loras_xl: C:/path/XL
  • loras_15: C:/path/1.5

Load Lora Example

Load Lora Folder

Dynamically applies Lora models based on similarity to a provided prompt.

ℹ️ See More Information
  • This node processes a given prompt to identify and apply the most similar Lora models of the tags found in the prompt.
  • For each part of the prompt, the node calculates a distance between tags and available Lora model filenames. The max distance can be chosen in the settings.
  • Example folder input: *master_folder, subfolder1:3, -excludefolder, subfolder2
    • *master_folder specifies all paths must include master_folder.
    • subfolder1:3 indicates up to 3 models from subfolder1 can be loaded.
    • -excludefolder ensures any path containing excludefolder is ignored.
    • subfolder2 loads models from this subfolder without a numeric limit.
  • Note: You need the loras separated into XL and 1.5 as stated in the Important Note.
  • Note: Loras need to be named very similarly to the tag, with at most 5 characters different. Words in the lora filename can be separated by spaces or underscores.

Load Lora Folder

Character and Text Processing

Nodes for selecting and combining character and textual elements.

Character Selector

Outputs a character name and prompt.

ℹ️ See More Information
  • Loads characters.json and outputs prompt based on it.
  • You can create a file named custom_characters.json and add characters there if you want, they will be loaded with all the other characters if you format it like the characters.json file.
  • If custom_characters.json has a character with the same name as characters.json it will add the custom prompt at the end of the normal one, this can be useful if you have loras that need activation tags.

Character Selector

Prompt Combine

Combines multiple strings with a specified separator and optionally simplifies the result by removing redundant or incompatible tags.

ℹ️ See More Information
  • If simplify is enabled, the simplification process identifies and removes redundant tags (e.g., when a tag is fully encompassed by another, more descriptive tag) and tags incompatible with factors such as facing away, covered eyes, etc. Any tags that are in parentheses will not be removed.
  • Simplify will also move 1girl/ 1boy to the front of the prompt to be in line with animagine 3's tagging if the option is enabled.

Prompt Combine

Utility Nodes

Nodes that provide utility functions across the system.

Find Resolution

An easy way to select a width and height.

ℹ️ See More Information
  • Enable flip if you want to swap the resolutions

Find Resolution

Get Font Size Node

Estimates the optimal font size for text to fit within an image based on Lora information.

ℹ️ See More Information
  • This node takes an image and a string, estimating the best font size to ensure that the longest piece of the string fits within the image. The approach considers the image's width and the length of the text to find a size that balances visibility and fit.

Get Font Size

Example Workflows

Lora Tester

Note: Uses ImagesGrid for making the actual grid from the image output.

Lora Tester

S
Description
No description provided
Readme MIT
20 MiB
Languages
Python 68.6%
HTML 17.5%
JavaScript 13.9%