From 07e27cd9dd26b8d81db9acfbe7d60c43bcf5732f Mon Sep 17 00:00:00 2001 From: Alphonsce Date: Tue, 23 Apr 2024 00:25:07 +0300 Subject: [PATCH] final versions of scripts --- .../stable_sig_different_distr/METR-METR.sh | 49 ++++++++++++++++++ scripts/stable_sig_different_distr/METR-N.sh | 49 ++++++++++++++++++ scripts/stable_sig_different_distr/N-METR.sh | 51 +++++++++++++++++++ scripts/stable_sig_different_distr/N-N.sh | 48 +++++++++++++++++ 4 files changed, 197 insertions(+) create mode 100644 scripts/stable_sig_different_distr/METR-METR.sh create mode 100644 scripts/stable_sig_different_distr/METR-N.sh create mode 100644 scripts/stable_sig_different_distr/N-METR.sh create mode 100644 scripts/stable_sig_different_distr/N-N.sh diff --git a/scripts/stable_sig_different_distr/METR-METR.sh b/scripts/stable_sig_different_distr/METR-METR.sh new file mode 100644 index 0000000..3275392 --- /dev/null +++ b/scripts/stable_sig_different_distr/METR-METR.sh @@ -0,0 +1,49 @@ +TRAIN_DIR=generated_images/imgs_w +VAL_DIR=val_mock + +CHECKPOINT_NAME=metr_metr +EVAL_PATH="$CHECKPOINT_NAME/imgs_w" + +# Fine-tuning: + +accelerate launch -m metr.finetune_ldm_decoder --num_keys 1 \ + --ldm_config v2-inference.yaml \ + --ldm_ckpt v2-1_512-ema-pruned.ckpt \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --train_dir $TRAIN_DIR \ + --val_dir $VAL_DIR \ + --with_tracking \ + --project_name finetune_ldm_decoder \ + --run_name test \ + --output_dir finetune_ldm_decoder \ + --batch_size 4 \ + --steps 50 \ + --num_val_imgs 1 \ + --not_rand_key \ + --key_str 111010110101000001010111010011010100010000100111 \ + --checkpoint_name $CHECKPOINT_NAME + +# Generation: + +accelerate launch -m metr.run_metr \ + --project_name generate_$CHECKPOINT_NAME \ + --run_name 3k_4k_generation --w_channel 3 --w_pattern ring \ + --start 3000 --end 4000 \ + --reference_model ViT-g-14 --reference_model_pretrain laion2b_s12b_b42k \ + --with_tracking \ + --save_locally \ + --local_path $CHECKPOINT_NAME \ + --decoder_state_dict_path finetune_ldm_decoder/$CHECKPOINT_NAME.pth + +# Evaluation: + +accelerate launch -m metr.metr_pp_eval_stable_sig \ + --with_tracking \ + --project_name eval_$CHECKPOINT_NAME \ + --run_name vae_st_tr_imgs_no_tree \ + --eval_imgs False --eval_bits True \ + --img_dir $EVAL_PATH \ + --output_dir logs_vae_st_tr_imgs_st_tr \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --attack_mode few \ + --key_str 111010110101000001010111010011010100010000100111 diff --git a/scripts/stable_sig_different_distr/METR-N.sh b/scripts/stable_sig_different_distr/METR-N.sh new file mode 100644 index 0000000..e63b2e0 --- /dev/null +++ b/scripts/stable_sig_different_distr/METR-N.sh @@ -0,0 +1,49 @@ +TRAIN_DIR=generated_images/imgs_w +VAL_DIR=val_mock + +CHECKPOINT_NAME=metr_n +EVAL_PATH="$CHECKPOINT_NAME/imgs_no_w" + +# Fine-tuning: + +accelerate launch -m metr.finetune_ldm_decoder --num_keys 1 \ + --ldm_config v2-inference.yaml \ + --ldm_ckpt v2-1_512-ema-pruned.ckpt \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --train_dir $TRAIN_DIR \ + --val_dir $VAL_DIR \ + --with_tracking \ + --project_name finetune_ldm_decoder \ + --run_name test \ + --output_dir finetune_ldm_decoder \ + --batch_size 4 \ + --steps 50 \ + --num_val_imgs 1 \ + --not_rand_key \ + --key_str 111010110101000001010111010011010100010000100111 \ + --checkpoint_name $CHECKPOINT_NAME + +# Generation: + +accelerate launch -m metr.run_metr \ + --project_name generate_$CHECKPOINT_NAME \ + --run_name 3k_4k_generation --w_channel 3 --w_pattern ring \ + --start 3000 --end 4000 \ + --reference_model ViT-g-14 --reference_model_pretrain laion2b_s12b_b42k \ + --with_tracking \ + --save_locally \ + --local_path $CHECKPOINT_NAME \ + --decoder_state_dict_path finetune_ldm_decoder/$CHECKPOINT_NAME.pth + +# Evaluation: + +accelerate launch -m metr.metr_pp_eval_stable_sig \ + --with_tracking \ + --project_name eval_$CHECKPOINT_NAME \ + --run_name vae_st_tr_imgs_no_tree \ + --eval_imgs False --eval_bits True \ + --img_dir $EVAL_PATH \ + --output_dir logs_vae_st_tr_imgs_st_tr \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --attack_mode few \ + --key_str 111010110101000001010111010011010100010000100111 diff --git a/scripts/stable_sig_different_distr/N-METR.sh b/scripts/stable_sig_different_distr/N-METR.sh new file mode 100644 index 0000000..8b6edc9 --- /dev/null +++ b/scripts/stable_sig_different_distr/N-METR.sh @@ -0,0 +1,51 @@ +TRAIN_DIR=fid_outputs/coco/ground_truth +VAL_DIR=val_mock + +CHECKPOINT_NAME=n_metr +EVAL_PATH="$CHECKPOINT_NAME/imgs_w" + +# Fine-tuning: + +accelerate launch -m metr.finetune_ldm_decoder --num_keys 1 \ + --ldm_config v2-inference.yaml \ + --ldm_ckpt v2-1_512-ema-pruned.ckpt \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --train_dir $TRAIN_DIR \ + --val_dir $VAL_DIR \ + --with_tracking \ + --project_name finetune_ldm_decoder \ + --run_name test \ + --output_dir finetune_ldm_decoder \ + --batch_size 4 \ + --steps 50 \ + --num_val_imgs 1 \ + --not_rand_key \ + --key_str 111010110101000001010111010011010100010000100111 \ + --checkpoint_name $CHECKPOINT_NAME + +# Generation: + +accelerate launch -m metr.run_metr \ + --project_name generate_$CHECKPOINT_NAME \ + --run_name 3k_4k_generation --w_channel 3 --w_pattern ring \ + --start 3000 --end 4000 \ + --reference_model ViT-g-14 --reference_model_pretrain laion2b_s12b_b42k \ + --with_tracking \ + --save_locally \ + --local_path $CHECKPOINT_NAME \ + --decoder_state_dict_path finetune_ldm_decoder/$CHECKPOINT_NAME.pth + +# Evaluation: + +EVAL_PATH="$CHECKPOINT_NAME/imgs_w" + +accelerate launch -m metr.metr_pp_eval_stable_sig \ + --with_tracking \ + --project_name eval_$CHECKPOINT_NAME \ + --run_name vae_st_tr_imgs_no_tree \ + --eval_imgs False --eval_bits True \ + --img_dir $EVAL_PATH \ + --output_dir logs_vae_st_tr_imgs_st_tr \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --attack_mode few \ + --key_str 111010110101000001010111010011010100010000100111 diff --git a/scripts/stable_sig_different_distr/N-N.sh b/scripts/stable_sig_different_distr/N-N.sh new file mode 100644 index 0000000..421dbe5 --- /dev/null +++ b/scripts/stable_sig_different_distr/N-N.sh @@ -0,0 +1,48 @@ +TRAIN_DIR=fid_outputs/coco/ground_truth +VAL_DIR=val_mock + +CHECKPOINT_NAME=n_n +EVAL_PATH="$CHECKPOINT_NAME/imgs_no_w" +# Fine-tuning: + +accelerate launch -m metr.finetune_ldm_decoder --num_keys 1 \ + --ldm_config v2-inference.yaml \ + --ldm_ckpt v2-1_512-ema-pruned.ckpt \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --train_dir $TRAIN_DIR \ + --val_dir $VAL_DIR \ + --with_tracking \ + --project_name finetune_ldm_decoder \ + --run_name test \ + --output_dir finetune_ldm_decoder \ + --batch_size 4 \ + --steps 50 \ + --num_val_imgs 1 \ + --not_rand_key \ + --key_str 111010110101000001010111010011010100010000100111 \ + --checkpoint_name $CHECKPOINT_NAME + +# Generation: + +accelerate launch -m metr.run_metr \ + --project_name generate_$CHECKPOINT_NAME \ + --run_name 3k_4k_generation --w_channel 3 --w_pattern ring \ + --start 3000 --end 4000 \ + --reference_model ViT-g-14 --reference_model_pretrain laion2b_s12b_b42k \ + --with_tracking \ + --save_locally \ + --local_path $CHECKPOINT_NAME \ + --decoder_state_dict_path finetune_ldm_decoder/$CHECKPOINT_NAME.pth + +# Evaluation: + +accelerate launch -m metr.metr_pp_eval_stable_sig \ + --with_tracking \ + --project_name eval_$CHECKPOINT_NAME \ + --run_name vae_st_tr_imgs_no_tree \ + --eval_imgs False --eval_bits True \ + --img_dir $EVAL_PATH \ + --output_dir logs_vae_st_tr_imgs_st_tr \ + --msg_decoder_path dec_48b_whit.torchscript.pt \ + --attack_mode few \ + --key_str 111010110101000001010111010011010100010000100111