Skip to content

Commit

Permalink
final readme version
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphonsce committed Apr 22, 2024
1 parent 07e27cd commit 777f481
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ finetune_ldm_decoder
*_images


fid_eval_*
fid_eval_*
val_mock
84 changes: 77 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ wget https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v
wget https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference.yaml
```

You can download our pre-trained for message `111010110101000001010111010011010100010000100111` VAE decoder from [here](https://huggingface.co/Alphonsce/St_Sig_vae_decoder/resolve/main/ldm_decoder_checkpoint_000.pth?download=true).
**You can download our pre-trained VAE Decoder for message `111010110101000001010111010011010100010000100111`:**

```bash
mkdir -p finetune_ldm_decoder
cd finetune_ldm_decoder
wget -O ldm_decoder_checkpoint_000.pth https://huggingface.co/Alphonsce/St_Sig_vae_decoder/resolve/main/ldm_decoder_checkpoint_000.pth?download=true
```

### Fine-tune VAE decoder to given ID:

Expand All @@ -181,7 +187,6 @@ VAL_DIR=generated_images/imgs_w
--batch_size 4 \
--steps 100 \
--num_val_imgs 200 \
--num_keys 1 \
--not_rand_key \
--key_str 111010110101000001010111010011010100010000100111
```
Expand Down Expand Up @@ -246,20 +251,85 @@ accelerate launch -m metr.run_metr_fid \
--msg_scaler 100 \
--use_stable_sig
```
---
# Reproducing experiments from paper:

## Reproducing experiments from paper:
## Diffusion and VAE attack on METR:

### Diffusion and VAE attack on METR:
### Diffusion attack:
```bash
bash scripts/metr_generative_att/diff_att_metr.sh
```
### VAE attack:
```bash
bash scripts/metr_generative_att/vae_2018_att_metr.sh
```

#### Diffusion attack:
## All attacks on METR:
### Detection:
```bash
bash scripts/metr_all_att/detect_metr_default_vae.sh
```
### Image Quality:
```bash
bash ./scripts/.sh
# FID gt
bash scripts/metr_all_att/fid_gt_all_att_metr.sh
# FID gen
bash scripts/metr_all_att/fid_gen_all_att_metr.sh
```
#### VAE attack:

## METR Image quality dispersion because of different message:
```bash
# FID gt:
bash scripts/fid_message_dispersion/gt.sh
# FID gen:
bash scripts/fid_message_dispersion/gen.sh
```

## All attacks on METR++:
### METR with fine-tuned VAE decoder:
```bash
bash scripts/metr_pp_all_att/detect_metr_changed_vae.sh
```

### Stable-Signature part of METR++:
```bash
# Generate images:
bash scripts/metr_pp_all_att/stable_sig_attacks/generate.sh
# Evaluate:
bash scripts/metr_pp_all_att/stable_sig_attacks/eval.sh
```

### Image quality:
```bash
# FID gt:
scripts/metr_all_att/fid_gt_all_att_metr.sh
# FID gen:
scripts/metr_all_att/fid_gen_all_att_metr.sh
```

## Stable-Signature tuned on images sampled from different distributions:

To run this, one need to have folder called `generated_images`, that was created using script provided in [section](#metr-detection-metrics-to-wandb).

Create mock val directory named `val_mock` with 1 image to run following scripts without error:
```bash
mkdir val_mock
cp fid_outputs/coco/ground_truth/000000000139.jpg val_mock
```

Run all fine-tunings, generations and evaluations:

```bash
# N-N
bash scripts/stable_sig_different_distr/N-N.sh
# N-METR
bash scripts/stable_sig_different_distr/N-METR.sh
# METR-N
bash scripts/stable_sig_different_distr/METR-N.sh
# METR-METR
bash scripts/stable_sig_different_distr/METR-METR.sh
```
---
# References:

Expand Down

0 comments on commit 777f481

Please sign in to comment.