Skip to content

tomguluson92/EraseAnything

Repository files navigation

EraseAnything (ICML 2025)

Paper PDF Project Page

Teaser

EraseAnything: Enabling Concept Erasure in Rectified Flow Transformers is an open-source project for Concept Erasing in Rectified Flow models: e.g. Flux, SD 3.

Features

  • ✅ Supports [diffusers]
  • ✅ Easy to extend and integrate

Installation & Environment Setup

  1. Install Rust (if required):

    curl https://sh.rustup.rs -sSf | sh
    export PATH="$HOME/.cargo/bin:$PATH"
  2. Install Python dependencies:

    pip install transformers sentencepiece einops omegaconf
    pip install tokenizers==0.20.0
    pip install nltk wandb openai
  3. Install local packages:

    cd peft
    pip install -e .[torch]
    
    or
    
    python setup.py install
    
    cd ../diffusers
    pip install -e .[torch]
    
    or
    
    python setup.py install

Quick Start

  1. Set AI Secret Key (Strongly recommend OpenRouter!)

    API_KEY='xxx'
    END_POINT='https://research-01-02.openai.azure.com/'
    API_VERSION = "2024-08-01-preview"
  2. Train the model:

    bash train.sh
  3. Run inference:

    python inference.py

Training & Inference

  • Training script: train.sh
  • Inference script: inference.py
  • Results will be saved in the results/ directory (if applicable).

Acknowledgments

This project is inspired by and builds upon the work of Erasing Concepts from Diffusion Models and other open-source projects. We thank the community for their valuable contributions.

Citation

If you use this project in your research, please cite:

@article{gao2024eraseanything,
  title={EraseAnything: Enabling Concept Erasure in Rectified Flow Transformers},
  author={Gao, Daiheng and Lu, Shilin and Walters, Shaw and Zhou, Wenbo and Chu, Jiaming and Zhang, Jie and Zhang, Bang and Jia, Mengxi and Zhao, Jian and Fan, Zhaoxin and others},
  journal={ICML 2025},
  year={2024}
}

Contact

For technical questions, please contact samuel.gao023@gmail.com.

About

EraseAnything, ICML 2025

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published