{"id":13487493,"url":"https://github.com/BorealisAI/advertorch","last_synced_at":"2025-03-27T22:31:26.459Z","repository":{"id":33610554,"uuid":"159734547","full_name":"BorealisAI/advertorch","owner":"BorealisAI","description":"A Toolbox for Adversarial Robustness Research","archived":false,"fork":false,"pushed_at":"2023-09-14T02:51:02.000Z","size":8587,"stargazers_count":1303,"open_issues_count":27,"forks_count":197,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-10-29T17:55:19.303Z","etag":null,"topics":["adversarial-attacks","adversarial-example","adversarial-examples","adversarial-learning","adversarial-machine-learning","adversarial-perturbations","benchmarking","machine-learning","pytorch","robustness","security","toolbox"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BorealisAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-29T22:17:33.000Z","updated_at":"2024-10-27T07:51:45.000Z","dependencies_parsed_at":"2023-10-20T18:34:30.074Z","dependency_job_id":null,"html_url":"https://github.com/BorealisAI/advertorch","commit_stats":{"total_commits":243,"total_committers":22,"mean_commits":"11.045454545454545","dds":0.6296296296296297,"last_synced_commit":"e063e341c87d9a621ae1a8f72c3507d5ea5bd327"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2Fadvertorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2Fadvertorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2Fadvertorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2Fadvertorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BorealisAI","download_url":"https://codeload.github.com/BorealisAI/advertorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222322034,"owners_count":16966433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adversarial-attacks","adversarial-example","adversarial-examples","adversarial-learning","adversarial-machine-learning","adversarial-perturbations","benchmarking","machine-learning","pytorch","robustness","security","toolbox"],"created_at":"2024-07-31T18:01:00.002Z","updated_at":"2025-03-27T22:31:26.429Z","avatar_url":"https://github.com/BorealisAI.png","language":"Jupyter Notebook","funding_links":[],"categories":["Robustness Toolboxes","Open Source Security Tools","Adversarial Robustness Libraries","Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Adversarial Attacks","Adversarial Robustness","Pytorch \u0026 related libraries","对抗学习与鲁棒性","PyTorch Tools, Libraries, and Frameworks","ToolBox"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"readme":"\u003ca href=\"https://github.com/borealisai/advertorch\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/borealisai/advertorch/master/assets/logo.png?raw=true\" alt=\"advertorch logo\" width=\"200\"\u003e\u003c/a\u003e\n\n[![Build Status](https://travis-ci.org/BorealisAI/advertorch.svg?branch=master)](https://travis-ci.org/BorealisAI/advertorch)\n\n\n\u003ca href=\"https://github.com/borealisai/advertorch\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/borealisai/advertorch/master/assets/advertorch.png?raw=true\" alt=\"advertorch text\" width=\"100\"\u003e\u003c/a\u003e is a Python toolbox for adversarial robustness research. The primary functionalities are implemented in PyTorch. Specifically, AdverTorch contains modules for generating adversarial perturbations and defending against adversarial examples, also scripts for adversarial training.\n\n\n#### Latest version (v0.2)\n\n## Installation\n\n### Installing AdverTorch itself\n\nWe developed AdverTorch under Python 3.6 and PyTorch 1.0.0 \u0026 0.4.1. To install AdverTorch, simply run\n\n```\npip install advertorch\n```\n\nor clone the repo and run\n```\npython setup.py install\n```\n\nTo install the package in \"editable\" mode:\n```\npip install -e .\n```\n\n### Setting up the testing environments\n\nSome attacks are tested against implementations in [Foolbox](https://github.com/bethgelab/foolbox) or [CleverHans](https://github.com/tensorflow/cleverhans) to ensure correctness. Currently, they are tested under the following versions of related libraries.\n```\nconda install -c anaconda tensorflow-gpu==1.11.0\npip install git+https://github.com/tensorflow/cleverhans.git@336b9f4ed95dccc7f0d12d338c2038c53786ab70\npip install Keras==2.2.2\npip install foolbox==1.3.2\n```\n\n\n## Examples\n```python\n# prepare your pytorch model as \"model\"\n# prepare a batch of data and label as \"cln_data\" and \"true_label\"\n# ...\n\nfrom advertorch.attacks import LinfPGDAttack\n\nadversary = LinfPGDAttack(\n    model, loss_fn=nn.CrossEntropyLoss(reduction=\"sum\"), eps=0.3,\n    nb_iter=40, eps_iter=0.01, rand_init=True, clip_min=0.0, clip_max=1.0,\n    targeted=False)\n\nadv_untargeted = adversary.perturb(cln_data, true_label)\n\ntarget = torch.ones_like(true_label) * 3\nadversary.targeted = True\nadv_targeted = adversary.perturb(cln_data, target)\n```\n\nFor runnable examples see [`advertorch_examples/tutorial_attack_defense_bpda_mnist.ipynb`](https://github.com/BorealisAI/advertorch/blob/master/advertorch_examples/tutorial_attack_defense_bpda_mnist.ipynb) for how to attack and defend; see [`advertorch_examples/tutorial_train_mnist.py`](https://github.com/BorealisAI/advertorch/blob/master/advertorch_examples/tutorial_train_mnist.py) for how to adversarially train a robust model on MNIST.\n\n## Documentation\n\nThe documentation webpage is on readthedocs  https://advertorch.readthedocs.io.\n\n\n## Coming Soon\n\nAdverTorch is still under active development. We will add the following features/items down the road:\n\n* more examples\n* support for other machine learning frameworks, e.g. TensorFlow\n* more attacks, defenses and other related functionalities\n* support for other Python versions and future PyTorch versions\n* contributing guidelines\n* ...\n\n\n## Known issues\n\n`FastFeatureAttack` and `JacobianSaliencyMapAttack` do not pass the tests against the version of CleverHans used. (They use to pass tests on a previous version of CleverHans.) This issue is being investigated. In the file `test_attacks_on_cleverhans.py`, they are marked as \"skipped\" in `pytest` tests. \n\n## License\n\nThis project is licensed under the LGPL. The terms and conditions can be found in the LICENSE and LICENSE.GPL files.\n\n## Citation\n\nIf you use AdverTorch in your research, we kindly ask that you cite the following [technical report](https://arxiv.org/abs/1902.07623):\n\n```\n@article{ding2019advertorch,\n  title={{AdverTorch} v0.1: An Adversarial Robustness Toolbox based on PyTorch},\n  author={Ding, Gavin Weiguang and Wang, Luyu and Jin, Xiaomeng},\n  journal={arXiv preprint arXiv:1902.07623},\n  year={2019}\n}\n```\n\n\n## Contributors\n\n* [Gavin Weiguang Ding](https://gwding.github.io/)\n* Luyu Wang\n* Xiaomeng Jin\n* Laurent Meunier\n* Alexandre Araujo\n* Jérôme Rony\n* Ben Feinstein\n* Francesco Croce\n* Taro Kiritani\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorealisAI%2Fadvertorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBorealisAI%2Fadvertorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBorealisAI%2Fadvertorch/lists"}