IntelLabs / MART

Modular Adversarial Robustness Toolkit
BSD 3-Clause "New" or "Revised" License
16 stars 0 forks source link

Move Perturber to Composer.Perturber #231

Closed mzweilin closed 9 months ago

mzweilin commented 9 months ago

What does this PR do?

This PR simplifies the abstraction of Adversary by moving adversary.perturber into adversary.composer.perturber

A Composer is a module that generates perturbed input from the benign input and the perturbation. The perturbation is the weights of the Composer module. Perturber is an object to manage the perturbation (e.g. initialization, projection) and return perturbation for Composer to work on.

A universal adversary should be able to use a Composer in the same way.

In the future, we may try to better integrate components in Perturber, such as Initializer and Projector, into Composer directly. For example, the image initializer should be implemented in Composer instead, so that we can easily constrain Lp bound on perturbation.

Type of change

Please check all relevant options.

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

Before submitting

Did you have fun?

Make sure you had fun coding 🙃

mzweilin commented 9 months ago

LGTM. Can you make sure the DDP test runs fine?

I confirm that DDP test runs fine. I'm merging this PR.