SPEED / README.md
nielsr's picture
nielsr HF Staff
Improve model card: Add pipeline tag, library name, sample usage, and citation
51046c0 verified
|
raw
history blame
3.81 kB
---
base_model:
- CompVis/stable-diffusion-v1-4
license: apache-2.0
pipeline_tag: text-to-image
library_name: diffusers
---
# SPEED
Here are the released model checkpoints of our paper:
> [SPEED: Scalable, Precise, and Efficient Concept Erasure for Diffusion Models](https://arxiv.org/abs/2503.07392)
![teaser](assets/teaser.JPEG)
**Three characteristics of our proposed method, SPEED.** **(a) Scalable:** SPEED seamlessly scales from single-concept to large-scale multi-concept erasure (e.g., 100 celebrities) without additional design. **(b) Precise:** SPEED precisely removes the target concept (e.g., *Snoopy*) while preserving the semantic integrity for non-target concepts (e.g., *Hello Kitty* and *SpongeBob*). **(c) Efficient:** SPEED can immediately erase 100 concepts within 5 seconds, achieving a ×350 speedup over the state-of-the-art (SOTA) method.
More implementation details can be found in our [GitHub repository](https://github.com/Ouxiang-Li/SPEED).
## Sample Usage
To perform image sampling with an edited checkpoint, use the following commands from the GitHub repository:
```python
# Instance Erasure
CUDA_VISIBLE_DEVICES=0 python sample.py \
--erase_type 'instance' \
--target_concept 'Snoopy, Mickey, Spongebob' \
--contents 'Snoopy, Mickey, Spongebob, Pikachu, Hello Kitty' \
--mode 'original, edit' \
--edit_ckpt '{checkpoint_path}' \
--num_samples 10 --batch_size 10 \
--save_root 'logs/few-concept/instance'
# Artistic Style Erasure
CUDA_VISIBLE_DEVICES=0 python sample.py \
--erase_type 'style' \
--target_concept 'Van Gogh' \
--contents 'Van Gogh, Picasso, Monet, Paul Gauguin, Caravaggio' \
--mode 'original, edit' \
--edit_ckpt '{checkpoint_path}' \
--num_samples 10 --batch_size 10 \
--save_root 'logs/few-concept/style'
# 10-Celebrity Erasure
CUDA_VISIBLE_DEVICES=0 python sample2.py \
--erase_type "10_celebrity" \
--target_concept "10_celebrity" \
--contents "erase, retain" \
--mode "original, edit" \
--edit_ckpt '{checkpoint_path}' \
--num_samples 1 --batch_size 10 \
--save_root "logs/multi_celebrity"
```
In the command above, you can configure the `--mode` to determine the sampling mode:
- `original`: Generate images using the original Stable Diffusion model.
- `edit`: Generate images with the erased checkpoint.
## Model Card
We provide several edited models with SPEED on Stable Diffusion v1.4.
| Concept Erasure Task | Edited Model |
|---|---|
| Few-Concept Erasure | <a href='https://huggingface.co/lioooox/SPEED/tree/main/few-concept' style="margin: 0 2px; text-decoration: none;"><img src='https://img.shields.io/badge/Hugging Face-ckpts-orange?style=flat&logo=HuggingFace&logoColor=orange' alt='huggingface'></a> |
| Multi-Concept Erasure | <a href='https://huggingface.co/lioooox/SPEED/tree/main/multi-concept' style="margin: 0 2px; text-decoration: none;"><img src='https://img.shields.io/badge/Hugging Face-ckpts-orange?style=flat&logo=HuggingFace&logoColor=orange' alt='huggingface'></a> |
| Implicit Concept Erasure | <a href='https://huggingface.co/lioooox/SPEED/tree/main/nudity' style="margin: 0 2px; text-decoration: none;"><img src='https://img.shields.io/badge/Hugging Face-ckpts-orange?style=flat&logo=HuggingFace&logoColor=orange' alt='huggingface'></a> |
## Citation
If you find the repo useful, please consider citing.
```
@misc{li2025speedscalablepreciseefficient,
title={SPEED: Scalable, Precise, and Efficient Concept Erasure for Diffusion Models},
author={Ouxiang Li and Yuan Wang and Xinting Hu and Houcheng Jiang and Tao Liang and Yanbin Hao and Guojun Ma and Fuli Feng},
year={2025},
eprint={2503.07392},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.07392},
}
```