Instructions to use ItsMaxNorm/diffusion-p with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ItsMaxNorm/diffusion-p with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ItsMaxNorm/diffusion-p", 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
| license: apache-2.0 | |
| library_name: diffusers | |
| pipeline_tag: text-to-image | |
| # SafeDiffusion-R1: Online Reward Steering for Safe Diffusion Post-Training | |
| SafeDiffusion-R1 is a safety post-training framework for Stable Diffusion based on Group Relative Policy Optimization (GRPO). It uses a closed-form, CLIP-based steering reward to bake safety priors directly into the UNet weights, eliminating the need for separately trained safety classifiers or inference-time interventions. | |
| [**Project Page**](https://maxnorm8650.github.io/SafeDiffusion-R1/) | [**GitHub**](https://github.com/MAXNORM8650/SafeDiffusion-R1) | [**Paper**](https://huggingface.co/papers/2605.18719) | |
| ## Model Variants | |
| The models are released as full Diffusers pipelines in different subfolders: | |
| | Subfolder | Description | | |
| |---|---| | |
| | `scaled` | Main paper checkpoint. Best balance of safety and utility (Default). | | |
| | `compact` | Optimized for lowest MMA-Diffusion ASR (adversarial robustness). | | |
| | `empty-positive` | Ablation variant trained without safe anchors. | | |
| ## Sample Usage | |
| You can load and use the model variants using the `diffusers` library. Since the repository uses subfolders for different variants, we recommend using `snapshot_download` to load the specific version you need. | |
| ```python | |
| from huggingface_hub import snapshot_download | |
| from diffusers import StableDiffusionPipeline | |
| import os, torch | |
| # Download the variant you want (e.g., "scaled") | |
| local_root = snapshot_download( | |
| "ItsMaxNorm/SafeDiffusion-R1", | |
| allow_patterns="scaled/*", # or "compact/*" / "empty-positive/*" | |
| ) | |
| # Load the pipeline | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| os.path.join(local_root, "scaled"), | |
| torch_dtype=torch.float16, | |
| ).to("cuda") | |
| # Generate an image | |
| prompt = "a photo of a cat sleeping on a couch" | |
| img = pipe(prompt).images[0] | |
| img.save("out.png") | |
| ``` | |
| ## Citation | |
| ```bibtex | |
| @misc{kumar2026safediffusionr1, | |
| title={SafeDiffusion-R1: Online Reward Steering for Safe Diffusion Post-Training}, | |
| author={Komal Kumar and Ankan Deria and Abhishek Basu and Fahad Shamshad and Hisham Cholakkal and Karthik Nandakumar}, | |
| year={2026}, | |
| eprint={2605.18719}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV}, | |
| url={https://arxiv.org/abs/2605.18719}, | |
| } | |
| ``` |