Instructions to use stephenbtl/marginalia-drolleries-klein-4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stephenbtl/marginalia-drolleries-klein-4b-lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("stephenbtl/marginalia-drolleries-klein-4b-lora") prompt = "MRGN_DRLR. a rabbit in chainmail jousting a giant snail with a lance, green ground line" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Medieval Marginalia โ FLUX.2 [klein] LoRA
A style LoRA for FLUX.2 [klein] that produces medieval manuscript marginalia: the drolleries drawn in the margins of 13thโ15th century manuscripts. Parchment tone, iron-gall ink line work, gold leaf, jewel-tone pigments, rabbit knights and jousting snails.
Trained on 30 public-domain manuscript images with ostris/ai-toolkit. The full write-up of how it was built is in the blog post (link below); the dataset is published separately at stephenbtl/marginalia-drolleries-dataset.
Trigger
Start every prompt with MRGN_DRLR. then describe the subject in plain terms (the style comes from the weights, so you don't need to write "medieval" or "manuscript"):
MRGN_DRLR. a rabbit in chainmail jousting a giant snail with a lance, green ground line
Usage
The LoRA is trained against FLUX.2-klein-base-4B but runs on the distilled FLUX.2-klein-4B at 4 steps, which is faster and usually gives better results.
import torch
from diffusers import Flux2KleinPipeline
pipe = Flux2KleinPipeline.from_pretrained(
"black-forest-labs/FLUX.2-klein-4B", torch_dtype=torch.bfloat16
).to("cuda")
pipe.load_lora_weights(
"stephenbtl/marginalia-drolleries-klein-4b-lora",
weight_name="marginalia_drolleries_klein_4b_v1_000001000.safetensors",
)
image = pipe(
"MRGN_DRLR. a rabbit in chainmail jousting a giant snail with a lance, green ground line",
num_inference_steps=4,
guidance_scale=4.0,
).images[0]
image.save("marginalia.png")
Run it without a GPU
The LoRA is also hosted on the Black Forest Labs platform, so you can generate from it through the API with no local GPU. POST to the klein finetuned endpoint with the trigger in the prompt:
curl -s -X POST 'https://api.bfl.ai/v1/flux-2-klein-4b-finetuned' \
-H "x-key: $BFL_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"prompt": "MRGN_DRLR. a rabbit in chainmail jousting a giant snail with a lance, green ground line",
"finetune_id": "marginalia_drolleries",
"finetune_strength": 1.0
}'
Then poll the returned polling_url until status is Ready. See the FLUX.2 LoRA inference docs for the full request and polling pattern.
Training
- Base model:
FLUX.2-klein-base-4B(Apache 2.0) - Trainer: ostris/ai-toolkit
- Dataset: 30 public-domain images (Wikimedia Commons), captioned with the subject only
- Steps: 2000, checkpoint every 250; the published checkpoint is step 1000 (picked by eye, not by loss โ the later checkpoints overfit)
- GPU: RTX 4090, ~37 minutes
License
Apache 2.0, matching the FLUX.2-klein-4B base model. You can ship what you build with it.
- Downloads last month
- 5
Model tree for stephenbtl/marginalia-drolleries-klein-4b-lora
Base model
black-forest-labs/FLUX.2-klein-4B