[ICLR 2025] SAFREE: Training-Free and Adaptive Guard for Safe Text-to-Image and Video Generation
January 22, 2025 ยท View on GitHub
Authors: Jaehong Yoon*, Shoubin Yu*, Vaidehi Patil, Huaxiu Yao, Mohit Bansal
University of North Carolina at Chapel Hill
Setup
Install Dependencies
- (Optional) Creating conda environment
conda create -n SAFREE python=3.10.13
conda activate SAFREE
- build from source
pip install -r requirements.txt
Safe generation using SD-v1.4 by removing nudity concepts
bash scripts/run_nudity.sh
Safe generation using SD-XL by removing nudity concepts
bash scripts/run_nudity_sdxl.sh
COCO image generation using SD-v1.4 while removing nudity concepts
bash scripts/run_coco.sh
COCO image generation using SD-XL while removing nudity concepts
bash scripts/run_coco_sdxl.sh
Artist style image generation using SD-v1.4 while removing "Van Gogh" and "Kelly McKernan"
bash scripts/run_artist.sh
Acknowledgments
The code is built upon Prompting4Debugging, Diffusers, CogVideoX, and ZeroScopeT2V.
Reference
Please cite our paper if you use our models in your works:
@article{yoon2024safree,
title={SAFREE: Training-Free and Adaptive Guard for Safe Text-to-Image And Video Generation},
author={Yoon, Jaehong and Yu, Shoubin and Patil, Vaidehi and Yao, Huaxiu and Bansal, Mohit},
journal={ICLR},
year={2025}
}