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
| """Cached identity + dense gold experiment. Can prompt language push more kintsugi?""" | |
| 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.7, 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") | |
| print("Identity loaded. Kintsugi LoRA boosted to 1.2") | |
| dense_gold_scenes = [ | |
| "She was shattered into a hundred pieces and every single one was repaired with gold. Hundreds of fine gold-filled cracks cover her entire body like a roadmap of survival. Gold across both cheekbones branching down the jaw. Gold forking down the throat across the collarbones. Gold tracing every rib. Gold running down the spine splitting at the hips. She is looking at the viewer from a warm doorway. Intimate. Present. Every crack glows.", | |
| "Extreme close-up of her face. Dozens of gold kintsugi repair lines crisscross her cheeks forehead chin and temples like cracked porcelain reassembled with molten gold. Each line has depth and dimension. The gold sits raised above the ceramic surface. Her amber eyes catch the same warm light as the gold. Soft focus background. The most repaired face you have ever seen and the most beautiful because of it.", | |
| ] | |
| OUTPUT = "/Users/margaret/models/vera-triple-stack" | |
| for i, scene in enumerate(dense_gold_scenes): | |
| print(f"Generating dense gold {i+1}/2...") | |
| 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(500 + i), | |
| ).images[0] | |
| out = os.path.join(OUTPUT, f"vera_dense_gold_{i:02d}.png") | |
| img.save(out) | |
| print(f"Saved: {out}") | |
| print("Done. Every crack glows.") | |