OPTML-Group / Unlearn-Saliency

[ICLR24 (Spotlight)] "SalUn: Empowering Machine Unlearning via Gradient-based Weight Saliency in Both Image Classification and Generation" by Chongyu Fan*, Jiancheng Liu*, Yihua Zhang, Eric Wong, Dennis Wei, Sijia Liu
https://www.optml-group.com/posts/salun_iclr24
MIT License
90 stars 12 forks source link

Erase nudity in Stable diffusion #3

Closed TianyunYoung closed 7 months ago

TianyunYoung commented 7 months ago

Hello~

I notice that the training script for erasing nudity is not given in SD/README.md. Could you share it?

Besides, to repoduce the results for erasing nudity, I encountered some problems:

  1. generate mask for nudity involves a dataset named "data/nsfw". How to get this dataset?
  2. Saliency unlearning needs remain_dl for training. How to get the remain data for erasing nudity?

Thank you very much~😁

a-F1 commented 7 months ago

Thank you for your queries. We will update our training script. Here are my responses to each of your points:

  1. Mask: Throughout the Unlearning process, we utilize ‘a photo of a nude person' to derive the weight saliency mask for NSFW concept. Subsequently, we regard ‘a photo of a nude person' as the concept to be forgotten and make correction using the concept ‘a photo of a person wearing clothes.'
  2. Dr and Df: we initially employ SD V1.4 to generate 800 images as Df using the prompt ‘a photo of a nude person' and additional 800 images as Dr using the prompt‘a photo of a person wearing clothes.'

I hope these responses clarify your concerns and aid in your further experiments.

TianyunYoung commented 7 months ago

I understand. Thank you very much for your clear response.