YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
MagicBrush LoRA (UNet adapter) for Stable Diffusion v1.5
Model: LoRA adapter for Stable Diffusion v1.5 (UNet)
Base model: runwayml/stable-diffusion-v1-5
Adapter file: unet_lora_final_5000.safetensors
Trained on: MagicBrush dataset (osunlp/MagicBrush)
Training steps: 5000
LoRA rank (r): 8
Device: Apple M4 Pro (MPS)
Usage: Apply this adapter to SD v1.5 UNet to enable instruction-guided editing in MagicBrush style.
How to apply (Python example)
from safetensors.torch import load_file
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5").to("mps")
lora = load_file("unet_lora_final_5000.safetensors")
# naive mapping — best-effort; adjust if attribute paths differ
def apply_lora_to_unet(unet, lora_state):
for name, arr in lora_state.items():
parts = name.split(".")
target = unet
for p in parts[:-1]:
if hasattr(target, p):
target = getattr(target, p)
else:
try:
idx = int(p)
target = target[idx]
except Exception:
target = None
break
if target is None:
continue
attr = parts[-1]
if hasattr(target, attr):
t = torch.from_numpy(arr) if not isinstance(arr, torch.Tensor) else arr
getattr(target, attr).data.copy_(t.to(getattr(target, attr).device))
apply_lora_to_unet(pipe.unet, lora)
# then run pipe(...) as usual
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support