Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ReForge Prompt Director

A modular auto-prompt + image-to-tags + prompt steering suite for Stable Diffusion WebUI ReForge.

Turn reference images into usable prompts fast, keep batches in-sync, and optionally do character swaps + term switches (ex: male ↔ female) without your prompts breaking in ReForge batch / prompt-matrix.


✨ What this extension does (in one sentence)

It automatically generates and injects prompts into your workflow using images, so you spend less time writing prompts and more time generating.

Typical uses

  • Grab an image β†’ get a clean prompt (caption + tags) you can generate from
  • Batch folders of reference images safely (no β€œwrong image” or repeated caption bugs)
  • Character swap: use Image 2 to swap/replace character traits into Image 1’s scene
  • Prompt steering (age / camera angle / time / lighting) for consistent sets

βœ… Key Features

  • Batch-safe by design (works with ReForge batch, prompt matrix, dynamic prompts)
  • JoyCaption Ultra
    • image captioning β†’ SD-style prompt output
    • optional rewrite rules + constraint enforcement
    • optional post-switches (ex: term swaps)
  • WD14 Tagger
    • ONNX inference β†’ danbooru-style tag payloads
    • folder + Pixiv cache + single image sources
    • fusion modes (combine / replace) for character swapping
  • NovelAI CHAR Blocks (multi-character) πŸ†•
    • split each character's traits into NovelAI CHAR: slots
    • YOLO per-person detection β†’ reliable multi-character splitting from a single image
    • one-click βž• Add CHAR Blocks to Prompt (no copy-paste); merges into your existing prompt
    • NovelAI-V4 correct: spaces (not underscores), counts stay global, characters ordered leftβ†’right
  • QuickShot Prompt Director
    • deterministic prompt steering for consistent sets
    • age/time/view/camera/light controls
  • Modules can run independently or together

🧠 How it works (execution order)

For each prompt index in a batch:

  1. QuickShot modifies prompt text (no image needed)
  2. WD14 selects the correct image for that index
  3. WD14 tags inject into the prompt
  4. JoyCaption captions the same image (optional)
  5. Final prompt goes to the sampler

This prevents:

  • repeated captions
  • prompt/image desync in batch runs
  • the β€œfirst image gets reused” batch bug

πŸš€ Installation

Install via WebUI

  1. Open Stable Diffusion WebUI ReForge
  2. Go to Extensions β†’ Install from URL
  3. Paste: https://github.com/TdogCreations/ReForge-Prompt-Director
  4. Click Install
  5. Restart WebUI

Python deps: WD14 needs onnxruntime + pandas, multi-character detection needs ultralytics, and JoyCaption needs transformers (+ bitsandbytes for 4/8-bit). A requirements.txt is included so ReForge installs the core ones automatically on first load.


πŸ“₯ Required Model Downloads

This extension does not bundle large models. You install them manually.

1) WD14 Tagger (Required for WD14)

βœ… Recommended (best quality)

WD EVA02 Large Tagger v3

🟑 Alternative (older / slightly lighter)

WD EVA02 Large Tagger v2

Install WD14 files here

stable-diffusion-webui-reForge/ └─ models/ └─ wd14/ β”œβ”€ wd-eva02-large-tagger-v3.onnx └─ wd-eva02-large-tagger-v3.csv


2) JoyCaption Model (Required for JoyCaption)

βœ… llama-joycaption-beta-one
Hugging Face:
https://huggingface.co/fancyfeast/llama-joycaption-beta-one-hf-llava

You may need to be logged into Hugging Face to download.

Install here: stable-diffusion-webui-reForge/ └─ models/ └─ LLM/ └─ llama-joycaption-beta-one/ β”œβ”€ config.json β”œβ”€ generation_config.json β”œβ”€ model.safetensors β”œβ”€ tokenizer.json β”œβ”€ tokenizer_config.json └─ special_tokens_map.json

Do not rename the folder.
Do not place it inside the extension folder.


βš™οΈ Setup (Paths in WebUI)

WD14 Paths

  1. WebUI β†’ Settings β†’ WD14 Tagger
  2. Set:
    • WD14 Model Path β†’ .onnx
    • WD14 Tags Path β†’ .csv
  3. Apply settings β†’ restart WebUI

JoyCaption Path

  1. WebUI β†’ Settings β†’ JoyCaption
  2. Set JoyCaption Model Path to your local model folder
    Example: C:\stable-diffusion-webui-reForge\models\LLM\llama-joycaption-beta-one
  3. Apply settings β†’ restart WebUI

These paths are stored in your WebUI config β€” not inside this repo.


πŸ’Ύ Minimum System Requirements

VRAM (JoyCaption)

Mode Typical VRAM
4-bit (Fastest) ~10–12 GB
8-bit (Balanced) ~17–18 GB
Full FP16 ~24–25 GB

Minimum recommended GPU: 11 GB VRAM (with Low VRAM mode)
Recommended: 16 GB+ VRAM for smoother multi-model workflows

What β€œLow VRAM Mode” does

  • reduces cached memory usage
  • avoids holding multiple large components
  • unloads more aggressively after use

🎨 Pixiv Downloader (Optional) β€” PHPSESSID Setup

WD14 Tagger can download images directly from a Pixiv artwork URL and use them as the batch image source.

βœ… What you need

Pixiv requires a login session cookie called PHPSESSID.

This extension uses your PHPSESSID only to fetch the images you already have access to.

πŸ” How to get your PHPSESSID (Chrome / Edge)

  1. Log into Pixiv in your browser.
  2. Open Pixiv and go to any page (ex: your bookmarks or an artwork page).
  3. Press F12 to open Developer Tools
  4. Go to the Application tab
    (in some browsers it may be under Storage)
  5. In the left sidebar, open:
    • Cookies
    • Select: https://www.pixiv.net
  6. Find the cookie named: PHPSESSID
  7. Copy the Value (it will look like a long string such as 1234567_abcd...)

βš™οΈ Where to paste it in WebUI

  1. WebUI β†’ Settings β†’ WD14 Tagger
  2. Paste into: Pixiv PHPSESSID
  3. Apply settings β†’ restart WebUI

βœ… Your PHPSESSID is stored in your local WebUI settings (not this repo).
⚠️ Treat it like a password β€” never share it and don’t commit config files to GitHub.


πŸš€ Pixiv β†’ Prompt Workflow (Direct-to-Prompt)

Goal

Paste a Pixiv artwork URL β†’ download all pages β†’ auto-inject tags (and optionally JoyCaption captions) into your prompts.

Steps

  1. Enable WD14 Tagger
  2. Open Batch Sources β†’ Pixiv Gallery
  3. Turn ON Enable Pixiv
  4. Paste a Pixiv artwork URL, e.g.:
    • https://www.pixiv.net/en/artworks/123456789
  5. Click Download Images
  6. Choose your indexing mode:
    • Increment = each prompt uses the next Pixiv page
    • Random = random page per prompt
    • Fixed = always use the same page
  7. Generate normally (batch, matrix, dynamic prompts supported)

Optional: Add JoyCaption on the same Pixiv images

To make JoyCaption analyze the same image that WD14 selected:

  • Enable JoyCaption
  • Enable Use WD14 batch image paths (if available)

Now you get:

  • WD14 tags + JoyCaption captions both aligned per prompt index

πŸ›‘οΈ Pixiv Safety & Rate Limits (Read This)

This extension includes a basic safety throttle to reduce the chance of triggering Pixiv rate limits.

βœ… Built-in safety feature

  • Safety Delay slider adds a pause between image downloads.
  • This helps avoid hammering Pixiv’s servers with rapid-fire requests.

⚠️ Important warning (protect your Pixiv account)

Pixiv can rate-limit or flag accounts that download too aggressively.

Avoid:

  • Downloading hundreds of images in one go
  • Repeated downloads of the same large gallery
  • Running multiple download sessions at the same time

Recommended:

  • Use Safety Delay = 2–5 seconds
  • Download in smaller batches (ex: 10–30 images), then generate
  • If downloads start failing, stop and wait before trying again

πŸ”’ Privacy reminder

Your PHPSESSID is a login session cookie.

  • Treat it like a password
  • Never post it in screenshots
  • Never commit WebUI config files to GitHub

🧰 Usage

JoyCaption Ultra

Use it when you want image β†’ prompt captions, or rewrite/constraint control.

  • Enable JoyCaption in the JoyCaption UI
  • Choose quantization (4-bit is fastest)
  • Choose prompt style (SD Prompt / tag lists)
  • Optional rewrite rules, required/banned constraints, and post-switches

WD14 Tagger

Use it when you want image β†’ tags injection.

  • Choose image source:
  • single ref image
  • folder batch
  • Pixiv cached images
  • Choose prompt injection mode (append / prepend / replace)
  • Optional: Fusion Mode
  • Combine: add Image 2 tags
  • Replace: replace character traits using Image 2

QuickShot Prompt Director

Use it for consistent sets.

  • age group strength
  • time of day weighting
  • camera / viewpoint controls
  • lighting direction weighting
  • blur steering

QuickShot works even if WD14/JoyCaption are disabled.


🧬 NovelAI CHAR Blocks (Multi-Character)

Split a character's traits into NovelAI CHAR: blocks so each character gets their own prompt slot β€” instead of one flat tag soup. Scene/background tags stay in the global section above the blocks.

From WD14 (most accurate)

In WD14 Tagger β†’ 🧬 NAI CHAR Blocks:

  • βž• Add CHAR Blocks to Prompt β€” tags the loaded image and writes the CHAR blocks straight into your prompt box (no copy-paste). It merges into whatever you've already typed, preserving your existing CHAR: slots.
  • 🧍 Build CHAR Blocks (to box) β€” fills an output box for review/copy instead.
  • πŸ” Auto-detect characters (YOLO) β€” finds every person in Image 1, crops each, and tags them separately β†’ CHAR1 = leftmost person, CHAR2 = next, etc. (up to 6). This is the reliable way to separate multiple characters from one image.

It also runs automatically during generation: with Enable NovelAI CHAR blocks on, each detected person gets their own CHAR slot in the injected prompt.

From JoyCaption

Turn on the single 🧍 Enable NovelAI CHAR blocks toggle. JoyCaption produces a structured [GLOBAL] / [CHARx] caption that's parsed into CHAR: slots. If the model doesn't split cleanly, a built-in fallback pulls character-appearance tags into CHAR1 so you still get a block.

Notes

  • Multi-character detection uses YOLO (the ultralytics package). On first use it auto-downloads yolov8n.pt (~6 MB). To use your own detector, set Settings β†’ WD14 Tagger β†’ YOLO model for multi-char detection (.pt path).
  • CHAR-pipeline console logging is off by default; enable Settings β†’ JoyCaption β†’ Print CHAR-block debug to console if you need to troubleshoot.

πŸ§ͺ Batch & Prompt Matrix Support

Fully compatible with:

  • ReForge batch execution
  • prompt matrix
  • dynamic prompts
  • multi-image queues

Implementation detail:

  • batch state is stored on the Script instance, not per-prompt, to survive ReForge’s prompt/batch recreation behavior.

πŸ” Privacy & Safety

  • No telemetry
  • No analytics
  • No uploads
  • Pixiv PHPSESSID is stored only in WebUI settings
  • No credentials are written into the repo

⚠️ Common Mistakes / Fixes

  • WD14 does nothing β†’ ONNX/CSV paths not set in Settings
  • JoyCaption doesn’t load β†’ model folder path is wrong or missing files
  • Out of memory β†’ enable Low VRAM / use 4-bit / reduce batch size
  • Captions repeat β†’ restart WebUI after installing models (first-time load)

βš™οΈ Compatibility Notice

ReForge Prompt Director is built and tested exclusively for Stable Diffusion WebUI ReForge (Classic).

GitHub: https://github.com/Haoming02/sd-webui-forge-classic

It is not guaranteed to function correctly on:

  • Automatic1111 base WebUI
  • Forge Next or other experimental forks
  • ComfyUI or non-WebUI frontends

βœ… Tested Environment

  • ReForge Classic (latest)
  • Python 3.10+
  • CUDA 12.x
  • Windows 10 / 11

About

JoyCaption + WD14 + QuickShot for SD WebUI ReForge

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages