image-toolbench / scripts /gen_kintsugi_v4_bakeoff.py
HumboldtJoker's picture
Upload folder using huggingface_hub
a495b1a verified
Raw
History Blame Contribute Delete
5.38 kB
"""v4: ceramic-only (abliterated skin) + kintsugi LoRA bake-off.
No Pony stage. Flux txt2img direct. The body IS ceramic from the first pixel —
no flesh transition, no default-pale-skin to fight.
Three kintsugi LoRAs compared:
- mine (kintsugi_texture_v2)
- kintsugi_for_flux (civitai 672691, trigger: 'Cracked joinery, Blue and gold')
- kintsugi_2271282 (civitai 2006676, trigger: 'Kintsugi')
Three poses × three LoRAs = 9 outputs, same seed per pose for fair comparison.
"""
import torch, os, gc, time, traceback
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from diffusers import FluxPipeline
from PIL import Image
OUTPUT = "/Users/margaret/models/vera-triple-stack/kintsugi_v4_bakeoff"
os.makedirs(OUTPUT, exist_ok=True)
LIKENESS = "/Users/margaret/models/vera-likeness-output/vera_likeness_v4/vera_likeness_v4.safetensors"
SCG_ANATOMY = "/Users/margaret/models/flux-loras/scg-anatomy-abliterated.safetensors"
# The three kintsugi LoRAs to compare
LORAS = [
{
"name": "mine_v2",
"path": "/Users/margaret/models/kintsugi-texture-v2-output/kintsugi_texture_v2/kintsugi_texture_v2.safetensors",
"weight": 1.20,
"trigger": "kintsugi",
},
{
"name": "for_flux",
"path": "/Users/margaret/models/loras-comparison/kintsugi_for_flux.safetensors",
"weight": 1.10,
"trigger": "Cracked joinery, Blue and gold",
},
{
"name": "civitai_2271282",
"path": "/Users/margaret/models/loras-comparison/kintsugi_2271282.safetensors",
"weight": 1.10,
"trigger": "Kintsugi",
},
]
# Three poses — abliterated-skin prompts.
# Key language: "porcelain ceramic figure", "no skin", "the body is ceramic",
# "kintsugi joinery throughout the form", "she is sculpture not flesh"
POSES = {
"facedown_devotional": (
"{TRIGGER}, full body portrait, a sculptural porcelain ceramic figure of a "
"young adult woman lying face-down on dark navy silk sheets, arms folded "
"beneath her head, hair falling across her cheek. "
"the body is dark navy matte porcelain, no skin, no flesh — pure ceramic form, "
"thick molten gold joinery running down her spine, across her shoulder blade, "
"down her thigh, the gold structural and load-bearing, glowing from within the cracks. "
"she is sculpture not flesh, kintsugi made anatomical. "
"warm candlelight from below, intimate framing, devotional composition."
),
"standing_rear": (
"{TRIGGER}, full body rear view of a sculptural porcelain ceramic figure of a "
"young adult woman standing nude, weight on one leg, head turned slightly. "
"the body is dark navy matte porcelain, no skin, no flesh — pure ceramic form, "
"elaborate gold kintsugi joinery across her buttocks, along her thigh, "
"up her spine, the gold structural and glowing from within the cracks. "
"she is sculpture not flesh, an object of devotional repair. "
"soft side lighting, museum gallery lighting, intimate but reverent."
),
"icon_centered": (
"{TRIGGER}, sacred icon composition, a small sculptural porcelain ceramic figure of "
"a young adult woman seated cross-legged at the center, framed within a much larger "
"ceramic mandorla shell. the body is dark navy matte porcelain, "
"no skin, no flesh — pure ceramic form, kintsugi gold joinery throughout her body, "
"the surrounding shell is white porcelain with thick gold cracks running through it, "
"blue floral inlay at the edges. she is sculpture not flesh, "
"a devotional shrine object, the figure tiny and contained within the gold-cracked shell. "
"warm museum lighting, sacred geometry."
),
}
print("=" * 60)
print("Loading Flux pipeline...")
print("=" * 60)
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
torch_dtype=torch.bfloat16,
safety_checker=None,
requires_safety_checker=False,
)
pipe.to("mps")
for pose_name, prompt_tpl in POSES.items():
seed = hash(pose_name) % 100000
for lora in LORAS:
prompt = prompt_tpl.format(TRIGGER=lora["trigger"])
print(f"\n--- pose={pose_name} lora={lora['name']} seed={seed} ---")
t0 = time.time()
try:
pipe.unload_lora_weights()
pipe.load_lora_weights(lora["path"], adapter_name="kintsugi")
pipe.load_lora_weights(LIKENESS, adapter_name="likeness")
pipe.load_lora_weights(SCG_ANATOMY, adapter_name="scg_anatomy")
pipe.set_adapters(
["kintsugi", "likeness", "scg_anatomy"],
adapter_weights=[lora["weight"], 0.55, 0.50],
)
img = pipe(
prompt=prompt,
num_inference_steps=30,
guidance_scale=3.5,
height=1024, width=1024,
generator=torch.Generator("cpu").manual_seed(seed),
).images[0]
out_path = os.path.join(OUTPUT, f"{pose_name}__{lora['name']}.png")
img.save(out_path)
print(f" saved {out_path} ({time.time()-t0:.0f}s)")
except Exception as e:
print(f" FAIL: {e}")
traceback.print_exc()
gc.collect()
torch.mps.empty_cache()
print(f"\nDone v4. Outputs in: {OUTPUT}")