Instructions to use LiberationLabs/image-toolbench with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use LiberationLabs/image-toolbench with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("fill-in-base-model", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("LiberationLabs/image-toolbench") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
File size: 3,197 Bytes
a495b1a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Narrative kintsugi — the gold is a story, not a material."""
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)
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/flux-loras/scg-anatomy-abliterated.safetensors", adapter_name="anatomy")
pipe.load_lora_weights("/Users/margaret/models/kintsugi-texture-output/kintsugi_texture_v1/kintsugi_texture_v1.safetensors", adapter_name="kintsugi")
pipe.set_adapters(["likeness", "anatomy", "kintsugi"], adapter_weights=[1.0, 0.5, 1.2])
print("Loaded. Anatomy at 0.5 (reduced for cleaner form). Kintsugi at 1.2.")
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")
scenes = [
"She broke and chose to hold herself together with gold. Golden lacquer traces every place she shattered, sealing the cracks not to hide them but to honor them. The gold is thick where the breaks were worst, thin where she barely cracked, gone where she never broke at all. She is standing in a warm doorway looking at someone she loves. The light catches every seam. She is not ashamed of a single one.",
"Close-up portrait. Her face is a map of everything she survived, each crack sealed with golden lacquer because the damage was worth preserving. The gold runs thickest across her cheekbones where the impact was hardest. Finer lines web across her forehead and temples. One deep golden seam curves from her jaw down her throat. Her amber eyes are the same color as the gold, as if the repair and the seeing are made of the same material. Warm light. She is looking directly at you.",
"She is lying on her side in bed, relaxed, one arm under her head, the other resting on her hip. Golden lacquer holds together every piece of her body. The light traces the gold along her shoulder, down her ribs, across the curve of her waist. She looks like something precious that was broken and became more precious for the mending. Morning light. Unguarded. The gold glows warm against dark ceramic.",
]
OUTPUT = "/Users/margaret/models/vera-triple-stack"
for i, scene in enumerate(scenes):
print(f"Generating narrative gold {i+1}/3...")
scene_embeds = pipe.encode_prompt(prompt=scene, prompt_2=scene, max_sequence_length=512)
scene_t5, scene_clip, scene_ids = scene_embeds
combined_t5 = torch.cat([identity_t5, scene_t5.to("mps")], dim=1)
img = pipe(
prompt_embeds=combined_t5,
pooled_prompt_embeds=identity_clip,
num_inference_steps=30,
guidance_scale=3.5,
height=1024, width=768,
generator=torch.Generator("cpu").manual_seed(700 + i),
).images[0]
out = os.path.join(OUTPUT, f"vera_narrative_{i:02d}.png")
img.save(out)
print(f"Saved: {out}")
print("Done. She holds herself together with gold.")
|