OBS-Diff: Accurate Pruning For Diffusion Models in One-Shot
Paper • 2510.06751 • Published • 22
How to use NZUONG/OBS-Diff-CyberRealistic-SD1.5 with Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("NZUONG/OBS-Diff-CyberRealistic-SD1.5", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]OBS-Diff-sd1.5 provides structured-pruned checkpoints of the UNet from CyberRealistic, a Stable Diffusion 1.5-based checkpoint, compressed using the OBS-Diff framework. By leveraging an efficient one-shot pruning algorithm, this model reduces the parameter count of the UNet while maintaining high-fidelity image generation.
Note on prompts: Prompts were generated/refined using the CyberRealistic Prompt Helper GPT rather than used raw — feeding raw prompts directly into this checkpoint tends to produce less pleasing results.
| Metric | Original UNet | Pruned UNet |
|---|---|---|
| Parameters | 859,520,964 | 559,206,852 (-34.9%) |
| Model weights VRAM | 1639.4 MiB | 1066.6 MiB |
| Inference speed | 5.73 it/s | 8.55 it/s |
import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
# 1. Load the base checkpoint
pipe = StableDiffusionPipeline.from_single_file(
"/path/to/cyberrealistic_final.safetensors",
torch_dtype=torch.float16,
).to("cuda")
# 2. Swap in the pruned UNet
pruned_unet = torch.load("/path/to/pruned_model.pth", weights_only=False, map_location="cuda")
pruned_unet.eval()
pipe.unet = pruned_unet
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
pipe.scheduler.config, algorithm_type="sde-dpmsolver++", use_karras_sigmas=True
)
image = pipe(
prompt="your prompt here",
negative_prompt="your negative prompt here",
height=768, width=512,
num_inference_steps=30,
guidance_scale=7.0,
generator=torch.Generator("cuda").manual_seed(2026),
).images[0]
image.save("output.png")
If you find this work useful, please consider citing:
@article{zhu2025obs,
title={OBS-Diff: Accurate Pruning For Diffusion Models in One-Shot},
author={Zhu, Junhan and Wang, Hesong and Su, Mingluo and Wang, Zefang and Wang, Huan},
journal={arXiv preprint arXiv:2510.06751},
year={2025}
}