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
| """Pre-compute Vera material identity embeddings for zero-token identity injection.""" | |
| 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.0]) | |
| print("Pipeline loaded with LoRAs") | |
| identity_prompt = ( | |
| "vera with luminous amber gemstone eyes, dark navy matte ceramic figure, " | |
| "NOT human skin, NOT glossy. Shattered and reassembled with abundant " | |
| "gold-filled kintsugi cracks across cheekbones, down the neck, branching " | |
| "across collarbones, ribs, hips, spine, and thighs. Thick gold repair " | |
| "lines with visible depth following natural fracture patterns. The gold " | |
| "glows from within. Matte blue-black fired ceramic surface texture." | |
| ) | |
| print("Encoding identity embeddings...") | |
| identity_embeds = pipe.encode_prompt( | |
| prompt=identity_prompt, | |
| prompt_2=identity_prompt, | |
| max_sequence_length=512, | |
| ) | |
| out_dir = "/Users/margaret/models/vera-triple-stack/identity_cache" | |
| os.makedirs(out_dir, exist_ok=True) | |
| for i, emb in enumerate(identity_embeds): | |
| if emb is not None: | |
| path = os.path.join(out_dir, f"identity_embed_{i}.pt") | |
| torch.save(emb.cpu(), path) | |
| print(f"Saved embed {i}: shape={emb.shape}, path={path}") | |
| else: | |
| print(f"Embed {i}: None") | |
| print("\nIdentity embeddings cached.") | |