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

49
examples/backgrounds.yaml Normal file
View File

@@ -0,0 +1,49 @@
# Background batch: generate multiple background images from independent prompts.
#
# Usage:
# vnasset pipeline --config examples/backgrounds.yaml
#
# Output structure:
# output/backgrounds_pipeline/
# pipeline.json
# backgrounds/
# classroom.png
# classroom.json
# hallway.png
# hallway.json
# ...
session:
sdxl_checkpoint: models/novaAnimeXL_ilV190.safetensors
output_dir: output/backgrounds_pipeline
defaults:
generate:
steps: 20
cfg: 4.5
negative_prompt: "deformed, ugly, bad quality, lowres"
width: 1024
height: 576
stages:
- id: backgrounds
generate:
- id: classroom
prompt: "anime classroom interior, empty, sunlight through windows, desks and chairs, blackboard, warm atmosphere"
seed: 100
- id: hallway
prompt: "anime school hallway, lockers, windows on one side, afternoon light, clean floor"
seed: 101
- id: park
prompt: "anime park, cherry blossoms, green grass, bench, path, spring afternoon, peaceful"
seed: 102
- id: rooftop
prompt: "anime school rooftop, blue sky, chain link fence, water tower, sunset colors"
seed: 103
- id: cafe
prompt: "anime cafe interior, cozy, warm lighting, wooden tables, counter with pastries, quiet afternoon"
seed: 104
- id: street
prompt: "anime city street, shops, pedestrians, evening, neon signs starting to glow"
seed: 105

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