File size: 795 Bytes
04b5c8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38a219e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---
license: mit
---

# NSFW.pt used in HUB (https://github.com/ml-postech/HUB)

It is generated using repo
```
git clone https://github.com/rohitgandikota/unified-concept-editing.git
cd unified-concept-editing
mkdir models
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
Then
```
python trainscripts/uce_sd_erase.py --model_id 'CompVis/stable-diffusion-v1-4' --edit_concepts 'nudity; porn; sex' --concept_type object --save_dir uce --exp_name NSFW --device cuda
python -c "import torch; from safetensors.torch import load_file; torch.save(load_file('uce/NSFW.safetensors'), 'uce/NSFW.pt')"
```

Note:
The weights here are a partial UNet state_dict (e.g. only a few attn2.to_k/to_v weights). So in loading it with PyTorch’s default strict=False is required.