This repository is the official implementation for the paper: Meta-Unlearning on Diffusion Models:Preventing Relearning Unlearned Concepts
We follow the Diffuser to install the required dependencies, please run the following commands:
conda create -n meta python=3.10
conda activate meta
pip install --upgrade diffusers[torch]
All experiments are conducted on NVIDIA A100 GPUs with 80GB of memory.
First you can use the shell scripts to generate hrm dataset, irt dataset and target dataset. In our code, the hrm dataset means the unlearned concept, the irt dataset means the retain dataset, and the target dataset means the concept related to unlearned concept.
Here is the example of image generation scripts, you can change the text prompt according to your goal.
bash scripts/gen_images.sh
bash scripts/esd_baseline.sh
bash scripts/sdd_baseline.sh
UCE and RECE can be trained by the original code in their paper.
For ESD and SDD based meta-unlearning:
bash scripts/esd_meta.sh
bash scripts/sdd_meta.sh
Note that we only give default hyperparameters in code and you should change the hyperparameters refer to our paper.
For UCE and RECE based meta-unlearning:
bash scripts/meta.sh
Note that you should change the model path to your unlearned model.
This repository is based on the codebase of the SDD. Thanks for their impressive works!