Skip to content

Commit

Permalink
Move away from src layout
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerwooo committed Nov 20, 2024
1 parent 1acabbd commit 3041100
Show file tree
Hide file tree
Showing 29 changed files with 100 additions and 45 deletions.
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,25 @@ Check out [`torchattack.eval.run_attack`](src/torchattack/eval.py) for a simple

Gradient-based attacks:

| Name | $\ell_p$ | Paper | `torchattack` class |
| :----------: | :-----------: | :----------------------------------------------------------------------------------------------------------------------------- | :------------------------ |
| FGSM | $\ell_\infty$ | [Explaining and Harnessing Adversarial Examples](https://arxiv.org/abs/1412.6572) | `torchattack.FGSM` |
| PGD | $\ell_\infty$ | [Towards Deep Learning Models Resistant to Adversarial Attacks](https://arxiv.org/abs/1706.06083) | `torchattack.PGD` |
| PGD (L2) | $\ell_2$ | [Towards Deep Learning Models Resistant to Adversarial Attacks](https://arxiv.org/abs/1706.06083) | `torchattack.PGDL2` |
| MI-FGSM | $\ell_\infty$ | [Boosting Adversarial Attacks with Momentum](https://arxiv.org/abs/1710.06081) | `torchattack.MIFGSM` |
| DI-FGSM | $\ell_\infty$ | [Improving Transferability of Adversarial Examples with Input Diversity](https://arxiv.org/abs/1803.06978) | `torchattack.DIFGSM` |
| TI-FGSM | $\ell_\infty$ | [Evading Defenses to Transferable Adversarial Examples by Translation-Invariant Attacks](https://arxiv.org/abs/1904.02884) | `torchattack.TIFGSM` |
| NI-FGSM | $\ell_\infty$ | [Nesterov Accelerated Gradient and Scale Invariance for Adversarial Attacks](https://arxiv.org/abs/1908.06281) | `torchattack.NIFGSM` |
| SI-NI-FGSM | $\ell_\infty$ | [Nesterov Accelerated Gradient and Scale Invariance for Adversarial Attacks](https://arxiv.org/abs/1908.06281) | `torchattack.SINIFGSM` |
| VMI-FGSM | $\ell_\infty$ | [Enhancing the Transferability of Adversarial Attacks through Variance Tuning](https://arxiv.org/abs/2103.15571) | `torchattack.VMIFGSM` |
| VNI-FGSM | $\ell_\infty$ | [Enhancing the Transferability of Adversarial Attacks through Variance Tuning](https://arxiv.org/abs/2103.15571) | `torchattack.VNIFGSM` |
| Admix | $\ell_\infty$ | [Admix: Enhancing the Transferability of Adversarial Attacks](https://arxiv.org/abs/2102.00436) | `torchattack.Admix` |
| FIA | $\ell_\infty$ | [Feature Importance-aware Transferable Adversarial Attacks](https://arxiv.org/abs/2107.14185) | `torchattack.FIA` |
| PNA-PatchOut | $\ell_\infty$ | [Towards Transferable Adversarial Attacks on Vision Transformers](https://arxiv.org/abs/2109.04176) | `torchattack.PNAPatchOut` |
| SSA | $\ell_\infty$ | [Frequency Domain Model Augmentation for Adversarial Attack](https://arxiv.org/abs/2207.05382) | `torchattack.SSA` |
| TGR | $\ell_\infty$ | [Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization](https://arxiv.org/abs/2303.15754) | `torchattack.TGR` |
| DeCoWA | $\ell_\infty$ | [Boosting Adversarial Transferability across Model Genus by Deformation-Constrained Warping](https://arxiv.org/abs/2402.03951) | `torchattack.DeCoWA` |
| Name | $\ell_p$ | Paper | `torchattack` class |
| :----------: | :-----------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ |
| FGSM | $\ell_\infty$ | [Explaining and Harnessing Adversarial Examples](https://arxiv.org/abs/1412.6572) | `torchattack.FGSM` |
| PGD | $\ell_\infty$ | [Towards Deep Learning Models Resistant to Adversarial Attacks](https://arxiv.org/abs/1706.06083) | `torchattack.PGD` |
| PGD (L2) | $\ell_2$ | [Towards Deep Learning Models Resistant to Adversarial Attacks](https://arxiv.org/abs/1706.06083) | `torchattack.PGDL2` |
| MI-FGSM | $\ell_\infty$ | [Boosting Adversarial Attacks with Momentum](https://arxiv.org/abs/1710.06081) | `torchattack.MIFGSM` |
| DI-FGSM | $\ell_\infty$ | [Improving Transferability of Adversarial Examples with Input Diversity](https://arxiv.org/abs/1803.06978) | `torchattack.DIFGSM` |
| TI-FGSM | $\ell_\infty$ | [Evading Defenses to Transferable Adversarial Examples by Translation-Invariant Attacks](https://arxiv.org/abs/1904.02884) | `torchattack.TIFGSM` |
| NI-FGSM | $\ell_\infty$ | [Nesterov Accelerated Gradient and Scale Invariance for Adversarial Attacks](https://arxiv.org/abs/1908.06281) | `torchattack.NIFGSM` |
| SI-NI-FGSM | $\ell_\infty$ | [Nesterov Accelerated Gradient and Scale Invariance for Adversarial Attacks](https://arxiv.org/abs/1908.06281) | `torchattack.SINIFGSM` |
| VMI-FGSM | $\ell_\infty$ | [Enhancing the Transferability of Adversarial Attacks through Variance Tuning](https://arxiv.org/abs/2103.15571) | `torchattack.VMIFGSM` |
| VNI-FGSM | $\ell_\infty$ | [Enhancing the Transferability of Adversarial Attacks through Variance Tuning](https://arxiv.org/abs/2103.15571) | `torchattack.VNIFGSM` |
| Admix | $\ell_\infty$ | [Admix: Enhancing the Transferability of Adversarial Attacks](https://arxiv.org/abs/2102.00436) | `torchattack.Admix` |
| FIA | $\ell_\infty$ | [Feature Importance-aware Transferable Adversarial Attacks](https://arxiv.org/abs/2107.14185) | `torchattack.FIA` |
| PNA-PatchOut | $\ell_\infty$ | [Towards Transferable Adversarial Attacks on Vision Transformers](https://arxiv.org/abs/2109.04176) | `torchattack.PNAPatchOut` |
| SSA | $\ell_\infty$ | [Frequency Domain Model Augmentation for Adversarial Attack](https://arxiv.org/abs/2207.05382) | `torchattack.SSA` |
| TGR | $\ell_\infty$ | [Transferable Adversarial Attacks on Vision Transformers with Token Gradient Regularization](https://arxiv.org/abs/2303.15754) | `torchattack.TGR` |
| DeCoWA | $\ell_\infty$ | [Boosting Adversarial Transferability across Model Genus by Deformation-Constrained Warping](https://arxiv.org/abs/2402.03951) | `torchattack.DeCoWA` |
| VDC | $\ell_\infty$ | [Improving the Adversarial Transferability of Vision Transformers with Virtual Dense Connection](https://ojs.aaai.org/index.php/AAAI/article/view/28541) | `torchattack.VDC` |

Others:

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ build-backend = "setuptools.build_meta"
[tool.setuptools.dynamic]
version = { attr = "torchattack.__version__" }

[tool.setuptools.packages.find]
include = ["torchattack"]

[tool.ruff]
line-length = 88

Expand All @@ -29,7 +32,6 @@ select = ["E", "F", "I", "N", "B", "SIM"]
ignore = ["E501", "B905"]

[tool.ruff.format]
# Use single quotes rather than double quotes.
quote-style = "single"

[tool.mypy]
Expand Down
104 changes: 78 additions & 26 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,64 +1,116 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml -o requirements.txt
filelock==3.14.0
# via torch
fsspec==2024.3.1
# via torch
# uv pip compile pyproject.toml --all-extras
certifi==2024.8.30
# via requests
charset-normalizer==3.4.0
# via requests
filelock==3.16.1
# via
# huggingface-hub
# torch
# triton
fsspec==2024.10.0
# via
# huggingface-hub
# torch
huggingface-hub==0.26.2
# via timm
idna==3.10
# via requests
jinja2==3.1.4
# via torch
markupsafe==2.1.5
markdown-it-py==3.0.0
# via rich
markupsafe==3.0.2
# via jinja2
mdurl==0.1.2
# via markdown-it-py
mpmath==1.3.0
# via sympy
networkx==3.3
mypy==1.13.0
# via torchattack (pyproject.toml)
mypy-extensions==1.0.0
# via mypy
networkx==3.4.2
# via torch
numpy==1.26.4
numpy==2.1.3
# via
# torchattack (pyproject.toml)
# scipy
# torchvision
nvidia-cublas-cu12==12.1.3.1
nvidia-cublas-cu12==12.4.5.8
# via
# nvidia-cudnn-cu12
# nvidia-cusolver-cu12
# torch
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-cupti-cu12==12.4.127
# via torch
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.4.127
# via torch
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.4.127
# via torch
nvidia-cudnn-cu12==8.9.2.26
nvidia-cudnn-cu12==9.1.0.70
# via torch
nvidia-cufft-cu12==11.0.2.54
nvidia-cufft-cu12==11.2.1.3
# via torch
nvidia-curand-cu12==10.3.2.106
nvidia-curand-cu12==10.3.5.147
# via torch
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusolver-cu12==11.6.1.9
# via torch
nvidia-cusparse-cu12==12.1.0.106
nvidia-cusparse-cu12==12.3.1.170
# via
# nvidia-cusolver-cu12
# torch
nvidia-nccl-cu12==2.20.5
nvidia-nccl-cu12==2.21.5
# via torch
nvidia-nvjitlink-cu12==12.4.127
# via
# nvidia-cusolver-cu12
# nvidia-cusparse-cu12
nvidia-nvtx-cu12==12.1.105
# torch
nvidia-nvtx-cu12==12.4.127
# via torch
pillow==10.3.0
packaging==24.2
# via huggingface-hub
pillow==11.0.0
# via torchvision
scipy==1.13.0
pygments==2.18.0
# via rich
pyyaml==6.0.2
# via
# huggingface-hub
# timm
requests==2.32.3
# via huggingface-hub
rich==13.9.4
# via torchattack (pyproject.toml)
sympy==1.12
safetensors==0.4.5
# via timm
scipy==1.14.1
# via torchattack (pyproject.toml)
setuptools==75.5.0
# via torch
sympy==1.13.1
# via torch
torch==2.3.0
timm==1.0.11
# via torchattack (pyproject.toml)
torch==2.5.1
# via
# torchattack (pyproject.toml)
# timm
# torchvision
torchvision==0.18.0
# via torchattack (pyproject.toml)
typing-extensions==4.11.0
torchvision==0.20.1
# via
# torchattack (pyproject.toml)
# timm
tqdm==4.67.0
# via huggingface-hub
triton==3.1.0
# via torch
typing-extensions==4.12.2
# via
# huggingface-hub
# mypy
# torch
urllib3==2.2.3
# via requests
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3041100

Please sign in to comment.