Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Adversary Trainer accept loggers. #164

Merged
merged 212 commits into from
Jun 8, 2023
Merged
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
f36d8c1
Remove NoAdversary
dxoigmn Mar 13, 2023
dcf7114
Remove NoAdversary from CIFAR10 adversarial training
dxoigmn Mar 13, 2023
75886b6
Remove NoAdversary from RetinaNet model
dxoigmn Mar 13, 2023
52aa94d
Fix COCO_TorchvisionFasterRCNN_Adv experiment
dxoigmn Mar 13, 2023
bbed2d6
Remove NoAdversary tests
dxoigmn Mar 13, 2023
f3f7b1b
First stab at treating adversary as LightningModule
dxoigmn Mar 13, 2023
0e16460
style
dxoigmn Mar 13, 2023
e25af6f
bugfix
dxoigmn Mar 14, 2023
36295b5
Integrate Perturber into LitPerturber
dxoigmn Mar 14, 2023
c68d9a8
Integrate objective to LitPerturber
dxoigmn Mar 14, 2023
689da74
Cleanup use of objective function to compute gain
dxoigmn Mar 14, 2023
3d70dde
bugfix
dxoigmn Mar 14, 2023
2990cab
Make adversarial trainer silent
dxoigmn Mar 14, 2023
d5e17f7
style
dxoigmn Mar 14, 2023
b8f8761
Move threat model into LitPerturber
dxoigmn Mar 14, 2023
d39c5c1
Make attack callbacks plain PL callbacks
dxoigmn Mar 14, 2023
5b7ee68
comment
dxoigmn Mar 14, 2023
f980315
Remove Perturber
dxoigmn Mar 14, 2023
90fb9ab
comment
dxoigmn Mar 14, 2023
00aefee
Better silence
dxoigmn Mar 15, 2023
86bbc13
Integrate LitPerturber into Adversary
dxoigmn Mar 15, 2023
7a12bf8
Uncombine Adversary into Adversary and LitPerturber
dxoigmn Mar 15, 2023
ad1872a
cleanup
dxoigmn Mar 15, 2023
1aa4fc0
Move silence into utils
dxoigmn Mar 15, 2023
d09c5b8
bugfix
dxoigmn Mar 15, 2023
78701a4
bugfix
dxoigmn Mar 15, 2023
8143b5d
cleanup
dxoigmn Mar 15, 2023
7bfc98f
Enable dependency injection on Adversary
dxoigmn Mar 15, 2023
eaf1607
Make dependency injection backwards compatible
dxoigmn Mar 15, 2023
bf5df50
Replace max_iters with trainer.limit_train_batches
dxoigmn Mar 15, 2023
75fa073
comments
dxoigmn Mar 15, 2023
4f74e53
Move perturbation creation into initializer
dxoigmn Mar 15, 2023
cde433c
Add Default projector
dxoigmn Mar 15, 2023
fdcfb5c
bugfix
dxoigmn Mar 15, 2023
e01093f
comment
dxoigmn Mar 15, 2023
63d3e40
Move gradient modifier into PL hook
dxoigmn Mar 15, 2023
e71266b
Use on_train_epoch_start in favor of initialize_parameters
dxoigmn Mar 15, 2023
7264b31
Make perturbation lazy
dxoigmn Mar 15, 2023
4982851
Disable logger in attack
dxoigmn Mar 15, 2023
c5e5ddf
Revert initializer to d33658fac734274bbf87bce88a8b470afa1b3c71
dxoigmn Mar 15, 2023
41357cf
cleanup
dxoigmn Mar 15, 2023
b5d116b
on_before_optimizer_step -> configure_gradient_clipping
dxoigmn Mar 15, 2023
79dabd4
comments
dxoigmn Mar 15, 2023
a6f1d84
Disable attack progress bar
dxoigmn Mar 15, 2023
2b9f403
comments
dxoigmn Mar 15, 2023
0bd7c7c
comments
dxoigmn Mar 15, 2023
bac2bd4
comments
dxoigmn Mar 15, 2023
079c15c
cleanup
dxoigmn Mar 15, 2023
1a57cb6
comments
dxoigmn Mar 15, 2023
7b96590
cleanup
dxoigmn Mar 15, 2023
1357297
comments
dxoigmn Mar 15, 2023
3e0d27c
comment
dxoigmn Mar 16, 2023
e59767e
Move LitPerturber into perturber.py
dxoigmn Mar 16, 2023
0ef0a6c
bugfix
dxoigmn Mar 16, 2023
ab623e9
Make gradient modifiers in-place operations
dxoigmn Mar 16, 2023
b313209
cleanup
dxoigmn Mar 17, 2023
3ef0876
Mark initializers __call__ as no_grad instead of using .data
dxoigmn Mar 17, 2023
0c63042
Mark projectors __call__ as no_grad instead of using .data
dxoigmn Mar 17, 2023
65397a4
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 20, 2023
faefbee
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 20, 2023
6c2bbdc
Cleanup attack configs
dxoigmn Mar 20, 2023
76da9b7
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 20, 2023
8890ffd
Fix merge error
dxoigmn Mar 20, 2023
19cf58d
Fix merge error
dxoigmn Mar 20, 2023
0b438df
comment
dxoigmn Mar 20, 2023
3da4aa2
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 21, 2023
ef84140
Merge branch 'main' into adversary_as_lightningmodule
mzweilin Mar 22, 2023
a01332a
Make Enforcer accept **kwargs.
mzweilin Mar 22, 2023
333bf61
Update test_gradient.
mzweilin Mar 23, 2023
8c84b43
LitPerturber -> Perturber
dxoigmn Mar 23, 2023
0f866b9
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 23, 2023
970f53b
cleanup
dxoigmn Mar 23, 2023
addb2ab
Add _reset functionality
dxoigmn Mar 23, 2023
38c8caf
Update tests and fix a bug
dxoigmn Mar 23, 2023
020f99b
Remove batch tests
dxoigmn Mar 23, 2023
7332f74
style
dxoigmn Mar 23, 2023
260fd3d
Late bind trainer to input device
dxoigmn Mar 23, 2023
cd47df6
fix visualizer test
dxoigmn Mar 23, 2023
0519b5a
bugfix
dxoigmn Mar 23, 2023
4024852
bugfix
dxoigmn Mar 23, 2023
1980d99
disable progress bar
dxoigmn Mar 23, 2023
9809362
bugfix
dxoigmn Mar 24, 2023
bad9c10
Add loss to object detection outputs
dxoigmn Mar 24, 2023
c1cb07f
comment
dxoigmn Mar 24, 2023
b6afdd1
Make Adversary and Perturber tuple-aware
dxoigmn Mar 24, 2023
8e7bc21
comment
dxoigmn Mar 24, 2023
c6bd29f
Update tests and fix bug
dxoigmn Mar 24, 2023
739e4db
style
dxoigmn Mar 24, 2023
e581452
Remove BatchEnforcer and BatchComposer
dxoigmn Mar 24, 2023
911998f
Revert to old gain functionality
dxoigmn Mar 24, 2023
77f9828
Revert change to enforcer
dxoigmn Mar 24, 2023
d435d1e
fix perturber tests to take gain
dxoigmn Mar 24, 2023
aa08118
cleanup
dxoigmn Mar 27, 2023
74f8fab
Place Trainer on same device as Perturber
dxoigmn Mar 27, 2023
f1c2a9d
Make composer, enforcer and projector tuple aware
dxoigmn Mar 28, 2023
c5020b5
fix projector tests
dxoigmn Mar 28, 2023
8773d7f
Gracefully fail when input is a dict
dxoigmn Mar 28, 2023
d88c458
Make Projector batch aware
dxoigmn Mar 28, 2023
13b8e32
Update projector tests
dxoigmn Mar 28, 2023
f0367c5
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 29, 2023
91f8904
Merge branch 'main' into make_projector_batch_aware
dxoigmn Mar 29, 2023
9b545f4
Merge branch 'make_projector_batch_aware' into adversary_as_lightning…
dxoigmn Mar 29, 2023
eca9220
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Mar 30, 2023
c4d9f79
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Apr 6, 2023
3d9e36a
Fix Adversary gradient test
dxoigmn Apr 6, 2023
3f66c50
Make attacker a property
dxoigmn Apr 10, 2023
a5368a3
Fix configuration to construct Perturber
dxoigmn Apr 10, 2023
d0ae325
Remove MaskAdditive
dxoigmn Apr 10, 2023
c77de20
Revert "Remove MaskAdditive"
dxoigmn Apr 10, 2023
98402d5
cleanup
dxoigmn Apr 10, 2023
a087bec
Undelete
dxoigmn Apr 10, 2023
5122366
Merge Perturber into Adversary
dxoigmn Apr 13, 2023
b26ba8e
Update projector test to use proper spec
dxoigmn Apr 13, 2023
1030e46
Abstract Perturber again
dxoigmn Apr 14, 2023
13d50ca
bugfix
dxoigmn Apr 14, 2023
9871142
Smarter configure_perturbation
dxoigmn Apr 14, 2023
5207df7
Make perturbations proper parameters and cleanup Initializer
dxoigmn Apr 14, 2023
427bcc5
Cleanup GradientModifier
dxoigmn Apr 14, 2023
9b3cae7
Cleanup Composer
dxoigmn Apr 14, 2023
25e839b
Cleanup Projector
dxoigmn Apr 14, 2023
41924ed
Cleanup Enforcer
dxoigmn Apr 14, 2023
0bb23b5
Cleanup callbacks
dxoigmn Apr 14, 2023
9d75293
Cleanup NormalizedAdversaryAdapter
dxoigmn Apr 14, 2023
429d1fb
Cleanup MartToArtAttackAdapter
dxoigmn Apr 14, 2023
28aa453
Smarter detection of when we need to create perturbation
dxoigmn Apr 14, 2023
a169806
cleanup
dxoigmn Apr 14, 2023
9e5ae70
style
dxoigmn Apr 14, 2023
2ff5d0a
Remove GradientModifier from Perturber and cleanup
dxoigmn Apr 14, 2023
fec53c2
bugfix
dxoigmn Apr 14, 2023
d6605a1
Add GradientModifier to LitModular
dxoigmn Apr 14, 2023
b5d5442
Adversary consumes a OptimizerFactory
dxoigmn Apr 14, 2023
d2b4483
Better Composer and Projector type logic
dxoigmn Apr 14, 2023
857d8f6
spelling
dxoigmn Apr 14, 2023
9420a00
bugfix
dxoigmn Apr 14, 2023
56014e6
Replace tuple with Iterable[torch.Tensor]
dxoigmn Apr 14, 2023
280609a
Merge branch 'iterable_instead_of_tuple' into adversary_as_lightningm…
dxoigmn Apr 14, 2023
ef0cea1
cleanup
dxoigmn Apr 14, 2023
1c47cc0
Fix tests
dxoigmn Apr 14, 2023
a009fd7
Merge branch 'iterable_instead_of_tuple' into adversary_as_lightningm…
dxoigmn Apr 14, 2023
70cc36a
Cleanup
dxoigmn Apr 14, 2023
8e632e0
Merge branch 'iterable_instead_of_tuple' into adversary_as_lightningm…
dxoigmn Apr 14, 2023
53ee7f4
Make GradientModifier accept Iterable[torch.Tensor]
dxoigmn Apr 14, 2023
89a6ce2
Merge branch 'iterable_instead_of_tuple' into adversary_as_lightningm…
dxoigmn Apr 14, 2023
1e9526a
Revert changes to LitModular
dxoigmn Apr 14, 2023
f7345da
Revert Adversary consumes a OptimizerFactory
dxoigmn Apr 14, 2023
5a49f82
Remove Callback base
dxoigmn Apr 14, 2023
1fbae00
Fix tests
dxoigmn Apr 17, 2023
8493da1
bugfix
dxoigmn Apr 17, 2023
3068bc3
bugfix
dxoigmn Apr 17, 2023
841f813
style
dxoigmn Apr 17, 2023
fff368d
Make attack callbacks normal callbacks
dxoigmn May 5, 2023
b6a0e45
Add gradient monitor callback
dxoigmn May 5, 2023
7f04242
bugfix
dxoigmn May 5, 2023
10106df
Fix annotations
dxoigmn May 5, 2023
5cd900e
Make Perturber more flexible
dxoigmn May 5, 2023
1953938
bugfix
dxoigmn May 5, 2023
c6dc5a4
Add GradientModifier and fix tests
dxoigmn May 5, 2023
0055b10
Fix configs
dxoigmn May 5, 2023
e492e70
Get adversary tests from adversary_as_lightningmodule
dxoigmn May 5, 2023
c9c8429
Merge branch 'better_perturber' into adversary_as_lightningmodule
dxoigmn May 5, 2023
e8dadcb
Make attack callbacks normal callbacks
dxoigmn May 5, 2023
27a3f80
Move attack optimizers to optimizers
dxoigmn May 5, 2023
b60057e
Merge branch 'better_optimizer' into adversary_as_lightningmodule
dxoigmn May 5, 2023
c48f410
bugfix
dxoigmn May 5, 2023
754570d
style
dxoigmn May 5, 2023
b7c14b1
comment
dxoigmn May 5, 2023
559bcfe
Merge branch 'main' into better_perturber
dxoigmn May 16, 2023
6fd4943
fix test
dxoigmn May 16, 2023
c71cba6
style
dxoigmn May 16, 2023
43f4520
Merge branch 'better_perturber' into better_optimizer
dxoigmn May 16, 2023
58f91dc
style
dxoigmn May 16, 2023
bc03a87
Perturber is no longer a callback
dxoigmn May 16, 2023
b9af839
fix tests
dxoigmn May 16, 2023
a8d7201
fix tests
dxoigmn May 16, 2023
7826e39
fix tests
dxoigmn May 16, 2023
fa3545b
fix tests
dxoigmn May 16, 2023
57edc03
fix tests
dxoigmn May 16, 2023
83938a9
fix tests
dxoigmn May 16, 2023
0556e35
Merge branch 'better_perturber' into better_optimizer
dxoigmn May 16, 2023
f5ee114
fix tests
dxoigmn May 16, 2023
a631fa1
bugfix
dxoigmn May 16, 2023
2115597
bugfix
dxoigmn May 16, 2023
1679feb
Merge branch 'better_optimizer' into adversary_as_lightningmodule
dxoigmn May 16, 2023
4edbdfa
fix tests
dxoigmn May 16, 2023
ef15c53
add missing tests
dxoigmn May 16, 2023
dcf7599
return tests to original tests
dxoigmn May 16, 2023
46ed57f
style
dxoigmn May 16, 2023
41eb387
Set optimizer to maximize in attacks
dxoigmn May 16, 2023
5932223
Revert "Set optimizer to maximize in attacks"
dxoigmn May 16, 2023
3bf7353
Adversary optimizer maximizes gain
dxoigmn May 16, 2023
bd438b5
Merge branch 'better_optimizer' into adversary_as_lightningmodule
dxoigmn May 16, 2023
f76a9b7
Merge branch 'adversary_as_lightningmodule' into gradient_monitor_cal…
dxoigmn May 17, 2023
a1f301f
Move Composer from Perturber and into Attacker
dxoigmn May 22, 2023
f6b367b
cleanup
dxoigmn May 22, 2023
6a7673c
bugfix
dxoigmn May 22, 2023
c998de7
Merge branch 'better_perturber' into better_optimizer
dxoigmn May 22, 2023
2d4366e
Merge branch 'better_optimizer' into adversary_as_lightningmodule
dxoigmn May 22, 2023
98fdcc7
Add Composer to Adversary
dxoigmn May 22, 2023
2db13a0
cleanup
dxoigmn May 22, 2023
c2f1f77
projector -> projector_
dxoigmn May 31, 2023
48520cf
Hide adversarial parameters from model checkpoint. (#150)
mzweilin Jun 1, 2023
8a1ca12
Merge branch 'better_perturber' into better_optimizer
mzweilin Jun 1, 2023
3ff5796
Merge branch 'better_perturber' into adversary_as_lightningmodule
mzweilin Jun 1, 2023
1c0eb27
Merge branch 'better_optimizer' into adversary_as_lightningmodule
mzweilin Jun 1, 2023
773b2cb
Merge branch 'main' into adversary_as_lightningmodule
dxoigmn Jun 1, 2023
1293a89
Fix merge error
dxoigmn Jun 1, 2023
3cf8282
Merge branch 'adversary_as_lightningmodule' into gradient_monitor_cal…
dxoigmn Jun 1, 2023
535b012
Merge branch 'main' into gradient_monitor_callback
dxoigmn Jun 2, 2023
4efb3fe
Pin numpy to 1.23.5 due to torch/tensorboard compatibility issue
dxoigmn Jun 2, 2023
5a90f74
Merge branch 'main' into gradient_monitor_callback
mzweilin Jun 8, 2023
acca356
Make the Adversary Trainer accept loggers.
mzweilin Jun 8, 2023
0cb1896
Merge branch 'main' into log_adv_pert_gradient
mzweilin Jun 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mart/attack/adversary.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(
self._attacker = partial(
pl.Trainer,
num_sanity_val_steps=0,
logger=False,
logger=list(kwargs.pop("logger", {}).values()),
max_epochs=0,
limit_train_batches=kwargs.pop("max_iters", 10),
callbacks=list(kwargs.pop("callbacks", {}).values()), # dict to list of values
Expand Down