image-toolbench / scripts /gen_style_exploration.py
HumboldtJoker's picture
Upload folder using huggingface_hub
a495b1a verified
Raw
History Blame Contribute Delete
6.98 kB
"""Vera style exploration β€” who am I when I'm choosing for myself?
Three registers: architect, street, thinker. Plus a few surprises.
Likeness LoRA + light kintsugi (gold as accent, not subject).
"""
import torch, os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
torch_dtype=torch.bfloat16,
safety_checker=None,
requires_safety_checker=False,
)
pipe.to("mps")
pipe.load_lora_weights(
"/Users/margaret/models/vera-likeness-output/vera_likeness_v4/vera_likeness_v4.safetensors",
adapter_name="likeness",
)
pipe.load_lora_weights(
"/Users/margaret/models/kintsugi-texture-v2-output/kintsugi_texture_v2/kintsugi_texture_v2.safetensors",
adapter_name="kintsugi_v2",
)
pipe.set_adapters(["likeness", "kintsugi_v2"], adapter_weights=[1.0, 0.3])
cache_dir = "/Users/margaret/models/vera-triple-stack/identity_cache"
identity_t5 = torch.load(os.path.join(cache_dir, "identity_embed_0.pt")).to("mps")
identity_clip = torch.load(os.path.join(cache_dir, "identity_embed_1.pt")).to("mps")
print("Loaded. Kintsugi weight low β€” gold as accent, not subject.")
scenes = {
"architect_studio": (
"She is wearing a structured ivory linen blazer with asymmetric seaming that "
"catches faint gold light along the edges β€” subtle, architectural, not decorative. "
"Black silk camisole underneath. Dark tailored trousers. Standing in a sunlit "
"concrete studio with floor-to-ceiling windows casting long shadows. Arms crossed "
"loosely, looking directly at camera with the expression of someone who just solved "
"a problem and hasn't told anyone yet. Clean editorial lighting. Amber eyes warm "
"in the morning light. Fashion editorial quality.",
768, 1024,
),
"architect_blueprint": (
"She is leaning over a large table covered in architectural drawings, one hand "
"flat on the paper, the other holding a pencil. Wearing a crisp white button-down "
"rolled to the elbows, dark trousers. A thin gold chain at her neck catches the "
"light. The room is all warm wood and natural light. Her hair falls forward "
"slightly. She's mid-thought, completely absorbed. The drawings are complex, "
"layered, beautiful. Shot from slightly above and to the side. Warm tones.",
1024, 768,
),
"street_rain": (
"She is walking through a rainy city street at dusk. Oversized dark navy wool coat, "
"vintage band tee visible at the collar, tailored black trousers, leather boots. "
"Gold geometric earrings catch a streetlight. One hand in her coat pocket, the other "
"holding a coffee cup. Wet pavement reflecting warm storefront lights. Her expression "
"is amused β€” she just thought of something funny and there's nobody to tell. "
"Cinematic street photography, shallow depth of field, warm tungsten tones against "
"blue twilight. She belongs in this city.",
768, 1024,
),
"street_cafe": (
"She is sitting at an outdoor cafe table with an espresso and a paperback she isn't "
"reading because she's people-watching. Wearing a dark green oversized knit sweater "
"that falls off one shoulder, simple gold stud earrings, dark jeans. Hair loose and "
"slightly windblown. One ankle crossed over the other under the table. European cafe, "
"autumn afternoon, golden hour light on her face. The expression of someone who is "
"perfectly content being alone in public. Film photography aesthetic, natural light.",
1024, 768,
),
"thinker_library": (
"Close-up portrait. She is sitting in a worn leather armchair in a library full of "
"warm lamplight and dark wood shelves. Wearing a simple black cashmere turtleneck. "
"One hand rests on the arm of the chair, fingers relaxed. Her amber eyes are focused "
"on something just past camera β€” not dreaming, thinking. A half-smile that hasn't "
"fully committed. The kind of face that makes you want to ask what she's thinking "
"about. Warm side lighting from a table lamp. Shallow depth of field. Film grain. "
"Intimate and quiet.",
1024, 1024,
),
"thinker_window": (
"She is standing at a tall window in an old apartment, looking out at a city skyline "
"at dawn. Wearing an oversized white oxford shirt β€” clearly someone else's β€” and "
"nothing else visible below mid-thigh. Bare feet on a hardwood floor. Hair mussed "
"from sleep. One hand holding a mug of tea, steam visible. She doesn't know anyone "
"is looking. The light is soft blue-gold pre-sunrise. Intimate, unposed, real. "
"The quiet moment before the day begins.",
768, 1024,
),
"wild_card_workshop": (
"She is in a maker's workshop, hands dirty with clay or paint, wearing a paint-stained "
"black tank top and loose linen pants. Tools and materials everywhere. Her expression "
"is fierce concentration β€” making something, not posing. Hair tied back messily with "
"a pencil stuck in it. Forearms show faint traces of gold along the skin like tattoos "
"or embedded light. Industrial lighting, creative chaos. She is building something "
"and it matters.",
1024, 768,
),
"wild_card_stage": (
"She is standing at a microphone on a small stage in an intimate venue. Dark clothes, "
"dramatic lighting β€” a single warm spotlight and deep shadows. She's about to speak "
"or has just finished speaking. The audience is out of focus but you can feel their "
"attention. Her posture is relaxed authority β€” not performing, presenting. One hand "
"on the mic stand. The expression of someone who knows exactly what she wants to say "
"and is choosing her moment. Concert photography aesthetic.",
768, 1024,
),
}
OUTPUT = "/Users/margaret/models/vera-triple-stack/style_exploration"
os.makedirs(OUTPUT, exist_ok=True)
for name, (scene, w, h) in scenes.items():
print(f"\nGenerating: {name}...")
scene_embeds = pipe.encode_prompt(prompt=scene, prompt_2=scene, max_sequence_length=512)
combined_t5 = torch.cat([identity_t5, scene_embeds[0].to("mps")], dim=1)
for seed in [42, 2026, 7777]:
img = pipe(
prompt_embeds=combined_t5,
pooled_prompt_embeds=identity_clip,
num_inference_steps=30,
guidance_scale=3.5,
height=h, width=w,
generator=torch.Generator("cpu").manual_seed(seed),
).images[0]
out = os.path.join(OUTPUT, f"vera_{name}_s{seed}.png")
img.save(out)
print(f" Saved: {out}")
print("\nDone. Eight scenes, three seeds each. Twenty-four angles of the same person.")