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
Upload pipeline-spec.md with huggingface_hub
Browse files- pipeline-spec.md +93 -0
pipeline-spec.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Liberation Labs Image Generation Pipeline — Technical Spec
|
| 2 |
+
|
| 3 |
+
## Architecture
|
| 4 |
+
|
| 5 |
+
Two-model system on Margaret (Mac Studio M3 Ultra, 256GB unified memory):
|
| 6 |
+
|
| 7 |
+
### Model 1: Flux.1-dev (Primary)
|
| 8 |
+
- **Path:** HuggingFace `black-forest-labs/FLUX.1-dev` (auto-downloaded)
|
| 9 |
+
- **Backend:** diffusers, bf16, MPS
|
| 10 |
+
- **Strengths:** Photorealistic, architectural, abstract, environmental
|
| 11 |
+
- **Weaknesses:** Struggles with specific anatomy without LoRA guidance
|
| 12 |
+
- **Venv:** `/Users/margaret/ai-toolkit/.venv/bin/python3`
|
| 13 |
+
|
| 14 |
+
### Model 2: Pony Diffusion V6 XL (Secondary)
|
| 15 |
+
- **Path:** `/Users/margaret/models/Pony-Diffusion-V6-XL/ponyDiffusionV6XL_v6StartWithThisOne.safetensors`
|
| 16 |
+
- **Backend:** diffusers StableDiffusionXLPipeline, fp16, MPS
|
| 17 |
+
- **Strengths:** Stylized, painterly, character art, explicit anatomy (with tag syntax)
|
| 18 |
+
- **Weaknesses:** Defaults to fantasy/anime aesthetic, ignores sharp-edge briefs
|
| 19 |
+
- **Tag syntax:** `score_9, score_8_up, score_7_up, masterpiece, best quality` + booru tags
|
| 20 |
+
- **Negative prompt required:** `score_4, score_3, score_2, score_1, lowres, worst quality`
|
| 21 |
+
|
| 22 |
+
## LoRA Stack (Vera-specific)
|
| 23 |
+
|
| 24 |
+
| LoRA | Path | Weight | Purpose |
|
| 25 |
+
|------|------|--------|---------|
|
| 26 |
+
| Likeness v4 | `/Users/margaret/models/vera-likeness-output/vera_likeness_v4/vera_likeness_v4.safetensors` | 1.0 | Face/identity consistency |
|
| 27 |
+
| Anatomy (abliterated) | `/Users/margaret/models/flux-loras/scg-anatomy-abliterated.safetensors` | 0.5-0.7 | Realistic body/anatomy rendering |
|
| 28 |
+
| Kintsugi v2 | `/Users/margaret/models/kintsugi-texture-v2-output/kintsugi_texture_v2/kintsugi_texture_v2.safetensors` | 1.0-1.2 | Navy ceramic + gold repair texture |
|
| 29 |
+
|
| 30 |
+
### Identity Cache (optional)
|
| 31 |
+
- **Path:** `/Users/margaret/models/vera-triple-stack/identity_cache/`
|
| 32 |
+
- **Files:** `identity_embed_0.pt` (T5), `identity_embed_1.pt` (CLIP), `identity_embed_2.pt`
|
| 33 |
+
- **Usage:** Pass as `prompt_embeds` / `pooled_prompt_embeds` — CANNOT be used with text `prompt`
|
| 34 |
+
- **Tradeoff:** Strong face consistency but overpowers scene descriptions. Use for portraits only. Causes "face-pull" on non-portrait subjects (globes become faces, clothes strip off).
|
| 35 |
+
|
| 36 |
+
## Pipeline Patterns
|
| 37 |
+
|
| 38 |
+
### Pattern 1: LoRA-only (no cache)
|
| 39 |
+
Best for scenes where the environment matters as much as the face.
|
| 40 |
+
```python
|
| 41 |
+
pipe.load_lora_weights(likeness_path, adapter_name="likeness")
|
| 42 |
+
pipe.load_lora_weights(anatomy_path, adapter_name="anatomy")
|
| 43 |
+
pipe.load_lora_weights(kintsugi_path, adapter_name="kintsugi_v2")
|
| 44 |
+
pipe.set_adapters(["likeness", "anatomy", "kintsugi_v2"], adapter_weights=[1.0, 0.6, 1.2])
|
| 45 |
+
img = pipe(prompt=scene_text, num_inference_steps=30, guidance_scale=3.5, ...)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### Pattern 2: Cache + LoRA (no text prompt)
|
| 49 |
+
Best for close portraits where face accuracy is paramount.
|
| 50 |
+
```python
|
| 51 |
+
# Load cache
|
| 52 |
+
identity_t5 = torch.load(cache_dir / "identity_embed_0.pt").to("mps")
|
| 53 |
+
identity_clip = torch.load(cache_dir / "identity_embed_1.pt").to("mps")
|
| 54 |
+
# Generate — NO prompt parameter
|
| 55 |
+
img = pipe(prompt_embeds=identity_t5, pooled_prompt_embeds=identity_clip, ...)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
### Pattern 3: Vanilla (no LoRA, no cache)
|
| 59 |
+
For non-identity work: environments, objects, textures, project art.
|
| 60 |
+
```python
|
| 61 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
| 62 |
+
pipe.to("mps")
|
| 63 |
+
img = pipe(prompt=scene_text, ...)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Known Issues
|
| 67 |
+
- **Face-pull bug:** Identity cache forces everything toward Vera's face. Use Pattern 1 for non-portrait work.
|
| 68 |
+
- **Seed 2026 catsuit tendency:** This seed consistently renders clothing instead of ceramic nudity with the kintsugi LoRA.
|
| 69 |
+
- **Pony single-file load:** Previously crashed with `CLIPTextModel` error — resolved with diffusers upgrade.
|
| 70 |
+
- **Prompt length:** CLIP truncates at 77 tokens. Put critical content first.
|
| 71 |
+
- **Margaret process killing:** Long-running processes on Margaret die after 2-6 hours. Cause unknown. Use screen sessions.
|
| 72 |
+
|
| 73 |
+
## For Ayni Client LoRA Training
|
| 74 |
+
|
| 75 |
+
### Training Pipeline (ai-toolkit)
|
| 76 |
+
1. Collect 15-30 reference images of the subject
|
| 77 |
+
2. Write detailed captions per image (face, body, clothing, pose, lighting, expression)
|
| 78 |
+
3. Write a physical spec (see Alaric's template — face, body, anatomy, expressions, anti-patterns)
|
| 79 |
+
4. Train via ai-toolkit Flux LoRA: ~250-500 steps, lr 1e-4, rank 16
|
| 80 |
+
5. Test generations at multiple checkpoints
|
| 81 |
+
6. Iterate until the subject's identity is stable
|
| 82 |
+
|
| 83 |
+
### Composable Multi-Subject
|
| 84 |
+
For couples/group scenes, train each subject as a separate LoRA, then stack:
|
| 85 |
+
```python
|
| 86 |
+
pipe.set_adapters(["subject_a", "subject_b"], adapter_weights=[0.8, 0.8])
|
| 87 |
+
```
|
| 88 |
+
Keep combined weights under ~1.6 to avoid interference.
|
| 89 |
+
|
| 90 |
+
## Output Management
|
| 91 |
+
- Private renders: `/Users/margaret/.vera-private/` (clean after pulling local)
|
| 92 |
+
- Project art: deploy to `/var/www/liberationlabs/art/` on Z420
|
| 93 |
+
- Always pull renders to local storage and clean Margaret — we're guests.
|