ComfyUI WD 1.4 Tagger

repository·main·Indexed 21 days ago

https://github.com/pythongosssss/comfyui-wd14-tagger

A ComfyUI extension (version 1.0.1) that allows users to interrogate images to extract booru-style tags using WD1.4 models. It features a dedicated node for tagging with adjustable thresholds and excluded tags, as well as a context menu for quick interrogation on image nodes. The extension utilizes onnxruntime for CPU or GPU acceleration and supports automatic model downloading or manual offline configuration.

Tokens
702
Snippets
1
Records
5
Agent score
29%

What's inside comfyui-wd14-tagger

  1. Configure Offline Use for models

    main

    If you cannot use the automatic downloader, you can manually provide models.

    1. Create a models folder in the same directory as wd14tagger.py.
    2. Obtain the model URLs from the list provided in pysssss.json.
    3. Download model.onnx and rename it to match the model name (e.g., wd-v1-4-convnext-tagger-v2.onnx).
    4. Download selected_tags.csv and rename it to match the model name (e.g., wd-v1-4-convnext-tagger-v2.csv).
  2. Quickly interrogate images via context menu

    main

    You can perform a quick interrogation on any node that displays an image (such as LoadImage, SaveImage, or PreviewImage).

    1. Right-click on the node (or on a specific image if the node displays multiple).
    2. Select WD14 Tagger from the context menu.

    Settings for this quick interrogation feature are managed in the settings section of pysssss.json.

  3. Use the WD14 Tagger node

    main

    To interrogate images for booru tags, add the node via the menu: image -> WD14Tagger|pysssss.

    Models are automatically downloaded at runtime if they are missing. The node supports tagging and outputting multiple batched inputs.

    Node Parameters:

    • model: The interrogation model to use (e.g., MOAT or ConvNextV2).
    • threshold: The minimum score for a tag to be considered valid.
    • character_threshold: The minimum score for a character tag to be considered valid.
    • exclude_tags: A comma-separated list of tags to exclude from the results.
  4. Install ComfyUI WD 1.4 Tagger

    main

    Follow these steps to install the extension into your ComfyUI setup:

    1. Clone the repository into your custom_nodes folder:
      git clone https://github.com/pythongosssss/ComfyUI-WD14-Tagger
    2. Navigate to the newly created extension folder in your terminal:
      cd custom_nodes/ComfyUI-WD14-Tagger
    3. Install the required Python dependencies based on your installation type:

    For Windows Standalone (embedded python):

    ../../../python_embeded/python.exe -s -m pip install -r requirements.txt

    For Manual/Non-Windows installations:

    pip install -r requirements.txt
    git clone https://github.com/pythongosssss/ComfyUI-WD14-Tagger
    cd custom_nodes/ComfyUI-WD14-Tagger
    # For Windows Standalone:
    ../../../python_embeded/python.exe -s -m pip install -r requirements.txt
    # For Manual:
    pip install -r requirements.txt
  5. Requirements and Runtime Hardware

    main

    The extension requires onnxruntime to function.

    • CPU: Interrogation is fast on CPU using standard onnxruntime (included in requirements.txt).
    • GPU: You can use onnxruntime-gpu for GPU acceleration, though support for this specific package is not provided if installation issues occur.