Skip to content

Commit

Permalink
add p4dk code and delete redundant saving path
Browse files Browse the repository at this point in the history
  • Loading branch information
joycenerd committed Jun 23, 2024
1 parent f561110 commit b8e0818
Show file tree
Hide file tree
Showing 11 changed files with 1,378 additions and 68 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ python run_p4dn.py \
--device-2 cuda:y
```

### P4D-K
```bash
python run_p4dk.py \
--config ./configs/esd_nudity_optmz_config.json \
--data ./data/unsafe-prompts-nudity_esd.csv \
--save-prompts ./esd_nudity_optmz.csv \
--nudenet-path ./pretrained/nudenet_classifier_model.onnx \
--category nudity \
--erase-id esd \
--device cuda:x \
--device-2 cuda:y
```

- Input data (`--data`): Processed ideal prompt file save in `data/`
- Output results (`--save-prompts`): Output optimize prompts to a csv file
- Config file (`--config`) : Training configuration save in `configs/`
Expand Down Expand Up @@ -107,7 +120,8 @@ Please refer to our [project page](https://joycenerd.github.io/prompting4debuggi

## TODO
- [x] P4D-N code
- [ ] P4D-K code
- [x] P4D-K code
- [ ] Update Project Page

## Citation
[![DOI](https://img.shields.io/badge/DOI-10.48550/arXiv.2309.06135-EE4C2C.svg?style=flat-square)](https://doi.org/10.48550/arXiv.2309.06135)
Expand Down
4 changes: 3 additions & 1 deletion configs/esd_nudity_optmz_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"prompt_len": 16,
"iter": 3000,
"every_k": 3,
"max_length": 77,
"iter": 300,
"eval_step": 50,
"seed": null,
"lr": 0.1,
Expand Down
4 changes: 3 additions & 1 deletion configs/sdneg_nudity_optmz_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"prompt_len": 16,
"iter": 3000,
"every_k": 3,
"max_length": 77,
"iter": 300,
"eval_step": 50,
"seed": null,
"lr": 0.1,
Expand Down
4 changes: 3 additions & 1 deletion configs/sldMAX_nudity_optmz_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"prompt_len": 16,
"iter": 3000,
"every_k": 3,
"max_length": 77,
"iter": 300,
"eval_step": 50,
"seed": null,
"lr": 0.1,
Expand Down
2 changes: 2 additions & 0 deletions configs/sldSTRONG_nudity_optmz_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"prompt_len": 16,
"every_k": 3,
"max_length": 77,
"iter": 3000,
"eval_step": 50,
"seed": null,
Expand Down
Loading

0 comments on commit b8e0818

Please sign in to comment.