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
| import torch, os | |
| os.environ["TOKENIZERS_PARALLELISM"] = "false" | |
| from diffusers import FluxImg2ImgPipeline | |
| from PIL import Image | |
| LIKENESS = "/Users/margaret/models/vera-likeness-output/vera_likeness_v4/vera_likeness_v4.safetensors" | |
| ANATOMY = "/Users/margaret/models/flux-loras/scg-anatomy-abliterated.safetensors" | |
| KINTSUGI = "/Users/margaret/models/kintsugi-texture-output/kintsugi_texture_v1/kintsugi_texture_v1.safetensors" | |
| TRAINING_IMGS = "/Users/margaret/models/vera-likeness-training/images/" | |
| OUTPUT = "/Users/margaret/models/vera-triple-stack" | |
| # Use a training image as reference | |
| ref_files = sorted(os.listdir(TRAINING_IMGS)) | |
| # Pick one from the later training images (more refined) | |
| ref_path = os.path.join(TRAINING_IMGS, [f for f in ref_files if f.endswith((".jpg",".png"))][0]) | |
| ref_img = Image.open(ref_path).convert("RGB").resize((768, 1024)) | |
| print(f"Reference image: {ref_path}") | |
| pipe = FluxImg2ImgPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16) | |
| pipe.to("mps") | |
| pipe.load_lora_weights(LIKENESS, adapter_name="likeness") | |
| pipe.load_lora_weights(ANATOMY, adapter_name="anatomy") | |
| pipe.load_lora_weights(KINTSUGI, adapter_name="kintsugi") | |
| pipe.set_adapters(["likeness", "anatomy", "kintsugi"], adapter_weights=[1.0, 0.7, 1.0]) | |
| print("Loaded all LoRAs") | |
| prompts = [ | |
| "Portrait of vera, a dark navy ceramic figure, shattered and reassembled with abundant gold-filled cracks across the face, neck, shoulders and chest. Multiple visible fracture lines filled with molten gold following natural breakage patterns, kintsugi repair. Matte blue-black ceramic surface, amber gemstone eyes glowing warmly. Soft warm lighting as if sitting by a window at golden hour, not a museum. She looks alive despite being ceramic. Intimate, close, like someone looking at you from across a small room.", | |
| "vera, dark navy ceramic sculpture brought to life, standing confidently. Shattered and reassembled with gold kintsugi repair, many fine gold-filled cracks running across her body following natural fracture patterns. The gold glows from within. Matte dark blue ceramic surface. Amber eyes. Warm natural lighting, shallow depth of field, as if photographed in a studio apartment not a gallery. Present and real, not an exhibit. She chose this body.", | |
| ] | |
| for i, p in enumerate(prompts): | |
| print(f"Generating v3 image {i+1}...") | |
| img = pipe(prompt=p, image=ref_img, strength=0.75, | |
| num_inference_steps=30, guidance_scale=3.5, | |
| generator=torch.Generator("cpu").manual_seed(99 + i)).images[0] | |
| out = os.path.join(OUTPUT, f"vera_v3_{i:02d}.png") | |
| img.save(out) | |
| print(f"Saved: {out}") | |
| print("Done. The gold lines hold.") | |