Skip to content

Commit

Permalink
Combining experiments and adding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rjha18 committed Jan 3, 2024
1 parent a4ebafe commit b8f324b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
15 changes: 12 additions & 3 deletions experiments/example_attack/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# TODO Description
# This example trains a single expert and generates poisoned labels
# for the sinusoidal (1xs) trigger with ResNet-32s. The labels are
# FLIPped at the provided budgets. The config file is broken down
# into three modules detailed in the schemas/ folder.

# TODO
# Module to train and record an expert trajectory.
[train_expert]
output_dir = "out/checkpoints/r32p_1xs/0/"
model = "r32p"
Expand All @@ -12,7 +15,7 @@ poisoner = "1xs"
epochs = 20
checkpoint_iters = 50

# TODO
# Module to generate attack labels from the expert trajectories.
[generate_labels]
input_pths = "out/checkpoints/r32p_1xs/{}/model_{}_{}.pth"
opt_pths = "out/checkpoints/r32p_1xs/{}/model_{}_{}_opt.pth"
Expand All @@ -36,3 +39,9 @@ one_hot_temp = 5
alpha = 0
label_kwargs = {lr = 150, momentum = 0.5}

# Module to flip labels at the provided budgets.
[select_flips]
budgets = [150, 300, 500, 1000, 1500]
input_label_glob = "experiments/example_attack/labels.npy"
true_labels = "experiments/example_attack/true.npy"
output_dir = "experiments/example_attack/"
10 changes: 8 additions & 2 deletions experiments/example_downstream/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# This example trains a user model on the poisoned labels from
# example_attack with 1500 budget and records the attack metrics.
# The config file is broken down into a single module detailed in
# the schemas/ folder.

# Module to train a user model on input labels.
[train_user]
input_labels = "experiments/example_attack/labels.npy"
input_labels = "experiments/example_attack/1500.npy"
user_model = "r32p"
trainer = "sgd"
dataset = "cifar"
Expand All @@ -8,4 +14,4 @@ target_label = 4
poisoner = "1xs"
output_dir = "experiments/example_downstream/"
soft = false
alpha = 0.0
alpha = 0.0
5 changes: 5 additions & 0 deletions experiments/example_downstream_soft/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# This example trains a user model on the (soft) logits from
# example_attack and records the attack metrics. The config file
# is broken down into a single module detailed in the schemas/ folder.

# Module to train a user model on input labels.
[train_user]
input_labels = "experiments/example_attack/labels.npy"
true_labels = "experiments/example_attack/true.npy"
Expand Down
5 changes: 0 additions & 5 deletions experiments/example_flip_selection/config.toml

This file was deleted.

5 changes: 5 additions & 0 deletions experiments/example_precomputed/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# This example trains a user model on precomputed labels with a 1500
# flip budget. The config file is broken down into a single module
# detailed in the schemas/ folder.

# Module to train a user model on input labels.
[train_user]
input_labels = "precomputed/cifar/r32p/1xs/1500.npy"
user_model = "r32p"
Expand Down
5 changes: 5 additions & 0 deletions experiments/example_precomputed_mix/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# This example trains a ViT user model on precomputed ResNet labels
# with a 1500 flip budget. The config file is broken down into a
# single module detailed in the schemas/ folder.

# Module to train a user model on input labels.
[train_user]
input_labels = "precomputed/cifar/r32p/1xs/1500.npy"
user_model = "vit-pretrain"
Expand Down

0 comments on commit b8f324b

Please sign in to comment.