Skip to content

character

Generate character datasets using LLM-generated prompts + text-to-image (FLUX.2-klein local or cloud API).

Usage

bash
datasety character --output ./dataset --llm-ollama qwen3.5:4b

Notes

  • Thinking models (e.g. Qwen3.5-4B, Qwen3-4B): These models expose chain-of-thought reasoning as plain text. datasety filters meta-commentary lines automatically and trims the output to exactly --num-images prompts. For cleanest results use an API backend or a non-thinking instruction model.
  • FLUX.2-klein-9b-kv: When using --model black-forest-labs/FLUX.2-klein-9b-kv, the KV-cache pipeline is selected automatically and --cfg-scale is ignored (not supported by this pipeline).

LLM Backends (for prompt generation)

FlagBackendRequirements
--llm-apiOpenAI-compatible APIOPENAI_API_KEY env var
--llm-ollama MODELLocal OllamaOllama running locally
--llm-gguf PATHLocal GGUF modelllama-cpp-python
--llm-model REPOHuggingFace modeltransformers

Image Generation

By default, images are generated locally using FLUX.2-klein (requires GPU + PyTorch). Use --image-api to generate images via an OpenAI-compatible API instead (no GPU required).

Options

OptionDescriptionDefault
--reference, -rReference face image(s) (optional, prompt context)
--output, -oOutput directory(required)
--num-images, -nNumber of images10
--modelModel for generation (local HF or API model ID)black-forest-labs/FLUX.2-klein-4b-fp8
--ggufGGUF path/URL for quantized loading
--image-apiUse OpenAI-compatible API for image generationfalse
--api-aspect-ratioAspect ratio for --image-api (e.g. 9:16, 1:1)derived from --width/--height
--api-image-sizeResolution for --image-api: 0.5K, 1K, 2K, 4K
--character-descriptionText description of character
--styleStyle guidance
--prompts-onlyOnly generate promptsfalse
--prompts-fileLoad prompts from file
--deviceauto, cpu, cuda, or mpsauto
--stepsInference steps4
--cfg-scaleGuidance scale4.0
--seedRandom seed(random)
--heightOutput image height1024
--widthOutput image width1024
--output-formatpng, jpg, webppng
--batch-sizeFlush GPU memory every N images0 (off)
--dry-runPreview prompts without generating imagesfalse

Examples

bash
# Local pipeline with Ollama prompts
datasety character -o ./dataset --llm-ollama qwen3.5:4b --num-images 20

# Cloud API for images — FLUX.2-flex (no GPU needed)
OPENAI_API_KEY=sk-... OPENAI_BASE_URL=https://openrouter.ai/api/v1 \
  datasety character -o ./dataset --prompts-file prompts.txt \
  --image-api --model black-forest-labs/flux.2-flex --api-aspect-ratio 2:3

# Cloud API for images — Gemini 2.5 Flash
OPENAI_API_KEY=sk-... OPENAI_BASE_URL=https://openrouter.ai/api/v1 \
  datasety character -o ./dataset \
  --character-description "young warrior in samurai armor" --style "detailed anime" \
  --llm-api --image-api --model google/gemini-2.5-flash-image \
  --api-aspect-ratio 9:16 --num-images 10

# Preview prompts only
datasety character -o ./dataset --llm-api --prompts-only

# Use pre-written prompts with local pipeline
datasety character -o ./dataset --prompts-file prompts.txt

# Dry run
datasety character -o ./dataset --prompts-file prompts.txt --dry-run

Released under the MIT License.