Instructions to use ApacheOne/OBS-Diff-SDXL-creaprompthyper1.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ApacheOne/OBS-Diff-SDXL-creaprompthyper1.2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ApacheOne/OBS-Diff-SDXL-creaprompthyper1.2", dtype=torch.bfloat16, device_map="cuda") 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
OBS-Diff SDXL β CreaPrompt Hyper 1.2
Full-shape sparse SDXL UNets pruned with OBS-Diff at 20%, 30%, 40%, and 50%
Base checkpoint: CreaPrompt Hyper SDXL 1.2
Inference: 4 steps Β· CFG 0.0 Β· DPM++ SDE normal Β· 1024Γ1024
Format: Diffusers UNet2DConditionModel components
These are complete loadable SDXL UNet components, not complete text-to-image pipelines.
You still need the original checkpoint's two text encoders, tokenizers, VAE, and scheduler.
OBS-Diff applied unstructured pruning. The selected weights are stored as exact zeros, but the tensor shapes and parameter count remain unchanged. The folders are therefore approximately the same extracted size and do not automatically run faster with ordinary dense CUDA kernels.
Overview
This repository contains four independently pruned versions of the CreaPrompt Hyper SDXL 1.2 UNet:
| Variant | Targeted-weight sparsity | Whole-UNet zeros | Mean ImageReward | Delta vs. dense | Wins vs. dense | Mean generation time |
|---|---|---|---|---|---|---|
| Dense reference | 0.0000% | 0.0001% | +0.771080 | +0.000000 | β | 1.9656 s |
| OBS 20% | 20.0004% | 17.0132% | +0.758518 | -0.012563 | 2/4 | 1.9399 s |
| OBS 30% | 30.0004% | 25.5196% | +0.731054 | -0.040026 | 2/4 | 1.9611 s |
| OBS 40% | 40.0004% | 34.0260% | +0.687856 | -0.083225 | 3/4 | 1.9567 s |
| OBS 50% | 50.0004% | 42.5324% | +0.380332 | -0.390748 | 1/4 | 1.9403 s |
Preliminary interpretation
| Variant | Practical reading |
|---|---|
| 20% | Best overall fidelity/quality tradeoff in this small evaluation |
| 30% | Moderate quality decline with stronger output changes |
| 40% | More aggressive; won 3/4 individual comparisons but had a lower overall mean |
| 50% | Experimental; substantial quality instability and one severe failure |
The evaluation contains only four prompts, so these results are a screening benchmark, not a universal quality guarantee.
Repository structure
obs_diff_sdxl_results/
βββ images/
β βββ dense/
β βββ sparsity_20/
β βββ sparsity_30/
β βββ sparsity_40/
β βββ sparsity_50/
βββ unets/
β βββ sparsity_20/
β βββ sparsity_30/
β βββ sparsity_40/
β βββ sparsity_50/
βββ obs_sdxl_compare.html
βββ obs_sdxl_compare.json
βββ obs_sdxl_compare_scored.html
βββ obs_sdxl_compare_scored.json
βββ obs_diff_sdxl_prune.log
βββ obs_diff_sdxl_imagereward.log
Each unets/sparsity_* directory is a complete Diffusers UNet component produced with save_pretrained().
Visual comparisons
Adult bear standing in a field
| Dense | OBS 20% | OBS 30% | OBS 40% | OBS 50% |
|---|---|---|---|---|
| IR +1.138650 | IR +1.165112 | IR +1.243169 | IR +1.197060 | IR +1.149614 |
![]() |
![]() |
![]() |
![]() |
![]() |
Odd-looking toilet against a wall
| Dense | OBS 20% | OBS 30% | OBS 40% | OBS 50% |
|---|---|---|---|---|
| IR +0.776347 | IR +0.756794 | IR +0.515587 | IR +0.180844 | IR -0.667451 |
![]() |
![]() |
![]() |
![]() |
![]() |
Bathroom with a tub and counter
| Dense | OBS 20% | OBS 30% | OBS 40% | OBS 50% |
|---|---|---|---|---|
| IR +0.458368 | IR +0.508567 | IR +0.511803 | IR +0.560043 | IR +0.362720 |
![]() |
![]() |
![]() |
![]() |
![]() |
Large plane flying in the sky
| Dense | OBS 20% | OBS 30% | OBS 40% | OBS 50% |
|---|---|---|---|---|
| IR +0.710957 | IR +0.603597 | IR +0.653658 | IR +0.813476 | IR +0.676448 |
![]() |
![]() |
![]() |
![]() |
![]() |
Loading a pruned UNet
The saved folders can be loaded independently as UNet2DConditionModel components.
import torch
from diffusers import UNet2DConditionModel
REPO_ID = "ApacheOne/OBS-Diff-SDXL-creaprompthyper1.2"
unet = UNet2DConditionModel.from_pretrained(
REPO_ID,
subfolder="obs_diff_sdxl_results/unets/sparsity_20",
torch_dtype=torch.float16,
)
unet.eval()
print(type(unet).__name__)
print(f"Parameters: {sum(p.numel() for p in unet.parameters()):,}")
Available subfolders:
obs_diff_sdxl_results/unets/sparsity_20
obs_diff_sdxl_results/unets/sparsity_30
obs_diff_sdxl_results/unets/sparsity_40
obs_diff_sdxl_results/unets/sparsity_50
Text-to-image usage
These repositories contain the UNet only. Load the original complete CreaPrompt Hyper SDXL 1.2 checkpoint for the remaining SDXL components, then replace its UNet.
import torch
from diffusers import (
DPMSolverSinglestepScheduler,
StableDiffusionXLPipeline,
UNet2DConditionModel,
)
REPO_ID = "ApacheOne/OBS-Diff-SDXL-creaprompthyper1.2"
# Local copy of the original complete single-file checkpoint.
BASE_CHECKPOINT = (
"/content/models/hyper_sdxl_4step_471056.safetensors"
)
# Change to sparsity_20, sparsity_30, sparsity_40, or sparsity_50.
SPARSITY = "sparsity_20"
unet = UNet2DConditionModel.from_pretrained(
REPO_ID,
subfolder=f"obs_diff_sdxl_results/unets/{SPARSITY}",
torch_dtype=torch.float16,
)
pipe = StableDiffusionXLPipeline.from_single_file(
BASE_CHECKPOINT,
unet=unet,
torch_dtype=torch.float16,
use_safetensors=True,
)
pipe.scheduler = DPMSolverSinglestepScheduler.from_config(
pipe.scheduler.config,
algorithm_type="sde-dpmsolver++",
solver_order=2,
solver_type="midpoint",
lower_order_final=True,
use_karras_sigmas=False,
use_exponential_sigmas=False,
use_beta_sigmas=False,
final_sigmas_type="zero",
)
pipe.vae.enable_slicing()
pipe.vae.enable_tiling()
pipe.to("cuda")
generator = torch.Generator("cuda").manual_seed(1234)
image = pipe(
prompt=(
"a cinematic photograph of a red fox standing in snow, "
"detailed fur, natural lighting"
),
width=1024,
height=1024,
num_inference_steps=4,
guidance_scale=0.0,
generator=generator,
).images[0]
image.save("obs_diff_sdxl_test.png")
Technical details
Pruning method
OBS-Diff uses second-order information to select and compensate pruned weights. This adaptation calibrated the SDXL UNet using its four-step denoising trajectory and independently exported four sparsity targets.
Method: OBS-Diff / second-order unstructured pruning
Checkpoint format: Complete single-file SDXL checkpoint
UNet parameters: 2,567,463,684
Targeted parameters: 2,183,987,200
Calibration prompts: 16
Calibration size: 512Γ512
Comparison size: 1024Γ1024
Scheduler: DPM++ SDE normal
Inference steps: 4
Guidance scale: 0.0
OBS damping: 0.01
Column block: 128
Maximum tokens: 128
Evaluation seeds: 1234β1237
Quality metric: ImageReward
What β20β50%β means
The percentage names refer to sparsity among the targeted attention and feed-forward weights, not the percentage of the complete UNet file physically deleted.
| Variant | Targeted zeros | Whole-UNet zeros |
|---|---|---|
| OBS 20% | 20.0004% | 17.0132% |
| OBS 30% | 30.0004% | 25.5196% |
| OBS 40% | 40.0004% | 34.0260% |
| OBS 50% | 50.0004% | 42.5324% |
Why the files are not smaller
The pruning is unstructured:
Original dense tensor shape β same tensor shape
Selected FP16 values β replaced by exact zero
Parameter count β unchanged
An FP16 zero still occupies two bytes in a normal dense SafeTensors tensor. Therefore:
- all four UNets have approximately the same extracted size;
- normal dense CUDA kernels still execute the same matrix dimensions;
- standard inference does not receive a proportional speedup;
- specialized sparse storage and sparse kernels would be needed to convert the zero pattern into storage or runtime gains.
Benchmark notes
The comparison used only four prompts. Individual outputs can improve even when the aggregate mean declines:
- OBS 40% achieved the best ImageReward on the bathroom and plane examples.
- OBS 30% achieved the best ImageReward on the bear example.
- OBS 50% produced a major failure on the toilet example.
- OBS 20% stayed closest to the dense aggregate result.
Use the provided HTML and JSON reports for the full per-image metrics:
obs_diff_sdxl_results/obs_sdxl_compare_scored.html
obs_diff_sdxl_results/obs_sdxl_compare_scored.json
Limitations
- These are UNet components, not complete SDXL pipelines.
- The original text encoders, tokenizers, VAE, and scheduler are not included.
- The original CreaPrompt Hyper SDXL 1.2 checkpoint is required for matching T2I behavior.
- Sparsity is unstructured and does not physically shrink dense tensor dimensions.
- No retraining or recovery fine-tuning was performed.
- The benchmark is small and should not be treated as a general quality ranking.
- Results may change with prompt, seed, resolution, sampler, scheduler, and inference step count.
- The models were evaluated specifically at four steps and CFG 0.0.
Credits
- OBS-Diff: pruning method and reference implementation
- Diffusers: SDXL pipeline and UNet serialization
- ImageReward: prompt-image quality evaluation
- CreaPrompt Hyper SDXL 1.2: source checkpoint used for this experiment
- Downloads last month
- -



















