| --- |
| 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. |