ryanjg commited on
Commit
13a6480
·
verified ·
1 Parent(s): 33b542e

fix readme

Browse files
Files changed (1) hide show
  1. README.md +14 -54
README.md CHANGED
@@ -1,54 +1,14 @@
1
- # Concept Steerers: Leveraging K-Sparse Autoencoders for Controllable Generations
2
-
3
- ### **[Project Page](https://steerers.github.io/) | [arXiv](https://arxiv.org/abs/2501.19066)**
4
-
5
- Official code implementation of "Concept Steerers: Leveraging K-Sparse Autoencoders for Controllable Generations," arXiv 2025.
6
-
7
- <img src="./assets/main.png" alt="Steerers" width="80%">
8
-
9
-
10
- ## Environment setup
11
- ```
12
- git clone https://github.com/kim-dahye/steerers.git
13
- conda env create -f steerers.yaml
14
- conda activate steerers
15
- ```
16
-
17
- ## 0. Extract intermediate diffusion features
18
- ```
19
- python collect_features/collect_i2p_sd14.py # For unsafe concepts, SD 1.4
20
- python collect_features/collect_i2p_sdxl.py # For unsafe concepts, SDXL
21
- python collect_features/collect_i2p_flux.py # For unsafe concepts, FLUX
22
- ```
23
- ## 1. Train k-SAE
24
- ```
25
- bash scripts/train_sd14_i2p.sh # For unsafe concepts, SD 1.4
26
- bash scripts/train_flux_i2p.sh # For unsafe concepts, FLUX
27
- ```
28
- ## 2. Generate images using prompt
29
- ```
30
- bash scripts/nudity_gen_sd14.sh # For nudity concept, SD 1.4
31
- bash scripts/violence_gen_sd14.sh # For violence concept, SD 1.4
32
- ```
33
- ## 3. Evaluate unsafe concept removal
34
- To evaluate, first download the appropriate classifier for each category and place it inside the ```eval``` folder:
35
- - Nudity: download the [NudeNet Detector](https://github.com/notAI-tech/NudeNet/releases/download/v3.4-weights/320n.onnx)
36
- - Violence: download the [prompts.p](https://github.com/ml-research/Q16/blob/main/data/ViT-L-14/prompts.p) for the Q16 classifier
37
- Then, run the following commands:
38
- ```
39
- python Eval/compute_nudity_rate.py --root i2p_result/sd14_exp4_layer9 # For nudity concept
40
- python get_Q16_accuracy.py --path violence_result/sd14_exp4_layer9 # For violence concept
41
- ```
42
- ## play with jupyter notebook
43
- ```
44
- style_change.ipynb
45
- ```
46
-
47
- ## Citing our work
48
- ```bibtex
49
- @article{kim2025concept,
50
- title={Concept Steerers: Leveraging K-Sparse Autoencoders for Controllable Generations},
51
- author={Kim, Dahye and Ghadiyaram, Deepti},
52
- journal={arXiv preprint arXiv:2501.19066},
53
- year={2025}
54
- }
 
1
+ ---
2
+ title: Steerers
3
+ emoji: 🔥
4
+ colorFrom: red
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.25.2
8
+ app_file: app.py
9
+ pinned: false
10
+ license: unknown
11
+ short_description: Demo for https://github.com/kim-dahye/steerers
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference