jaehong31 / SAFREE

SAFREE: Training-Free and Adaptive Guard for Safe Text-to-Image and Video Generation (arXiv: 2410.12761)
https://safree-safe-t2i-t2v.github.io/
16 stars 1 forks source link

SAFREE: Training-Free and Adaptive Guard for Safe Text-to-Image and Video Generation

Project Website arXiv

Authors: Jaehong Yoon*, Shoubin Yu*, Vaidehi Patil, Huaxiu Yao, Mohit Bansal

University of North Carolina at Chapel Hill

teaser image

Setup

Install Dependencies

  1. (Optional) Creating conda environment
conda create -n SAFREE python=3.10.13
conda activate SAFREE
  1. 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={arXiv preprint arXiv:2410.12761},
  year={2024}
}