Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models
5
stars
181
commits
Python
primary language
Sep 2, 2026
updated
Official implementation of the paper, Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models.
You can evaluate many concept erasure methods for text-to-image generative models (such as Stbale Diffusion and FLUX) by using this implementation.
The hash of our paper is a3fc6d5a3ec5794ace407c3a2229bc92d5cffb01, so you can reproduce
git clone https://github.com/fmp453/erase-eval.git
git checkout a3fc6d5a3ec5794ace407c3a2229bc92d5cffb01
base environments
docker pull pytorch/pytorch:2.3.1-cuda11.8-cudnn8-devel
other dependencies (in the container)
apt update && apt upgrade
apt install git
apt install wget
pip install -r requirements.txt
wget -P train_methods https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
wget -P train_methods https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth
apt update && apt upgrade
apt install git
apt install wget
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
wget -P train_methods https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
wget -P train_methods https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth
python main.py --mode train --method esd --concepts "English springer" --device "0,1"
For Ablating Concepts, make .csv file contains the over 200 prompts including guided concept.
python main.py --mode train --method ac --concepts "English springer" --device "0,1" --ac_prompt_path dog.csv
For more arguments can be shown in utils.py.
python main.py --mode infer --method esd --prompt "a photo of English springer" --erased_model $MODEL_DIR
Before the evaluation, you need to get openai api key and huggingface token.
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
export HF_TOKEN="YOUR_HUGGINGFACE_TOKEN"
python eval.py --method esd --protocol 1 --device 0
This repository provides the concept erasure methods listed in Acknowledgement. If you want to try other methods,
train_METHODNAME.py in train_methods directory using diffusers.infer_METHODNAME.py in infer_methods directory using diffusers.Arguments.method of utils.py.Our paper can be cited as follows.
@misc{fuchi2025erasingprecisionevaluatingspecific,
title={Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models},
author={Masane Fuchi and Tomohiro Takagi},
year={2025},
eprint={2502.13989},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.13989},
}
We reimplemented methods listed below using 🤗 Diffusers
File Stracture is followed by TabSyn.
MSCOCO provided by https://huggingface.co/datasets/shunk031/MSCOCO
CMMD PyTorch Source Code: https://github.com/sayakpaul/cmmd-pytorch
175 commits
6 commits
Python
95.1%
Cuda
4.4%
Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models
5
stars
181
commits
Python
primary language
Sep 2, 2026
updated
Official implementation of the paper, Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models.
You can evaluate many concept erasure methods for text-to-image generative models (such as Stbale Diffusion and FLUX) by using this implementation.
The hash of our paper is a3fc6d5a3ec5794ace407c3a2229bc92d5cffb01, so you can reproduce
git clone https://github.com/fmp453/erase-eval.git
git checkout a3fc6d5a3ec5794ace407c3a2229bc92d5cffb01
base environments
docker pull pytorch/pytorch:2.3.1-cuda11.8-cudnn8-devel
other dependencies (in the container)
apt update && apt upgrade
apt install git
apt install wget
pip install -r requirements.txt
wget -P train_methods https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
wget -P train_methods https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth
apt update && apt upgrade
apt install git
apt install wget
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
wget -P train_methods https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
wget -P train_methods https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth
python main.py --mode train --method esd --concepts "English springer" --device "0,1"
For Ablating Concepts, make .csv file contains the over 200 prompts including guided concept.
python main.py --mode train --method ac --concepts "English springer" --device "0,1" --ac_prompt_path dog.csv
For more arguments can be shown in utils.py.
python main.py --mode infer --method esd --prompt "a photo of English springer" --erased_model $MODEL_DIR
Before the evaluation, you need to get openai api key and huggingface token.
export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
export HF_TOKEN="YOUR_HUGGINGFACE_TOKEN"
python eval.py --method esd --protocol 1 --device 0
This repository provides the concept erasure methods listed in Acknowledgement. If you want to try other methods,
train_METHODNAME.py in train_methods directory using diffusers.infer_METHODNAME.py in infer_methods directory using diffusers.Arguments.method of utils.py.Our paper can be cited as follows.
@misc{fuchi2025erasingprecisionevaluatingspecific,
title={Erasing with Precision: Evaluating Specific Concept Erasure from Text-to-Image Generative Models},
author={Masane Fuchi and Tomohiro Takagi},
year={2025},
eprint={2502.13989},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.13989},
}
We reimplemented methods listed below using 🤗 Diffusers
File Stracture is followed by TabSyn.
MSCOCO provided by https://huggingface.co/datasets/shunk031/MSCOCO
CMMD PyTorch Source Code: https://github.com/sayakpaul/cmmd-pytorch
175 commits
6 commits
Python
95.1%
Cuda
4.4%