add YAML-driven pipeline batch mode (vnasset pipeline)

Multi-stage pipelines declared in YAML: generate, edit (cross-product),
remove_bg, and upscale stages executed sequentially in a single GPU
session. Every intermediate artifact (image + metadata JSON) is saved
to {output_dir}/{stage_id}/ for full traceability.

Data routing:
- generate: list of prompts → list of images (1:1 per item)
- edit: fan-out cross-product (each input × each prompt)
- remove_bg / upscale: 1:1 passthrough

Resume: outputs that already exist are skipped. Use --force to re-run
everything — lets you add items to a stage without regenerating.

Examples: examples/portrait.yaml, examples/backgrounds.yaml
This commit is contained in:
Michele Rossi
2026-07-08 14:52:27 +02:00
parent 23135e62cb
commit bb08efd08c
6 changed files with 991 additions and 48 deletions

74
examples/portrait.yaml Normal file
View File

@@ -0,0 +1,74 @@
# Portrait pipeline: generate base character → emotion variants → remove bg → upscale.
#
# Usage:
# vnasset pipeline --config examples/portrait.yaml
# vnasset pipeline --config examples/portrait.yaml --force # re-run everything
#
# Output structure:
# output/portrait_pipeline/
# pipeline.json ← pipeline summary
# base/ ← stage 1: generated portraits
# heroine.png
# heroine.json
# expressions/ ← stage 2: emotion edits (cross-product)
# heroine_smile.png
# heroine_smile.json
# heroine_angry.png
# ...
# nobg/ ← stage 3: background removed (RGBA)
# heroine_smile_nobg.png
# ...
# final/ ← stage 4: upscaled 2×
# heroine_smile_nobg_x2.png
# ...
session:
sdxl_checkpoint: models/novaAnimeXL_ilV190.safetensors
edit_model: models/qwen_image_edit_2509_fp8_e4m3fn.safetensors
edit_lora: models/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors
output_dir: output/portrait_pipeline
defaults:
generate:
steps: 20
cfg: 4.5
negative_prompt: "deformed, ugly, bad quality, lowres"
edit:
steps: 4
cfg: 1.0
stages:
# ── Stage 1: Generate base character portrait ──
- id: base
generate:
- id: heroine
prompt: "1girl, solo, red hair, glasses, blue eyes, white crop top, standing, portrait"
seed: 42
# ── Stage 2: Edit expression variants (fan-out cross-product) ──
- id: expressions
edit:
input: base
prompts:
- id: smile
text: "make her smile happily with a warm genuine smile"
- id: angry
text: "make her look angry and furious, furrowed brow"
- id: sad
text: "make her look sad and crying, tears in her eyes"
- id: surprised
text: "make her look surprised, wide eyes, mouth slightly open"
- id: blushing
text: "make her blush intensely, embarrassed expression, pink cheeks"
# ── Stage 3: Remove backgrounds (batch 1:1 passthrough) ──
- id: nobg
remove_bg:
input: expressions
# ── Stage 4: Upscale to 2× resolution ──
- id: final
upscale:
input: nobg
scale: 2