{ "info": { "author": "MadryLab", "author_email": "ailyas@mit.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "robustness package\n==================\nInstall via ``pip``: ``pip install robustness``\n\nRead the docs: https://robustness.readthedocs.io/en/latest/index.html\n\n``robustness`` is a package we (students in the `MadryLab `_) created\nto make training, evaluating, and exploring neural networks flexible and easy.\nWe use it in almost all of our projects (whether they involve\nadversarial training or not!) and it will be a dependency in many of our\nupcoming code releases. A few projects using the library include:\n\n- `Code for \"Learning Perceptually-Aligned Representations via Adversarial Robustness\" `_ (https://arxiv.org/abs/1906.00945) \n- `Code for\n \"Image Synthesis with a Single (Robust) Classifier\" `_ (https://arxiv.org/abs/1906.09453)\n\nWe\ndemonstrate how to use the library in a set of walkthroughs and our API\nreference. Functionality provided by the library includes:\n\n- Training and evaluating standard and robust models for a variety of\n datasets/architectures using a `CLI interface\n `_. The library also provides support for adding\n `custom datasets `_ and `model architectures `_.\n\n.. code-block:: bash\n\n python -m robustness.main --dataset cifar --data /path/to/cifar \\\n --adv-train 0 --arch resnet18 --out-dir /logs/checkpoints/dir/\n\n- Performing `input manipulation\n `_ using robust (or standard)\n models---this includes making adversarial examples, inverting representations,\n feature visualization, etc. The library offers a variety of optimization\n options (e.g. choice between real/estimated gradients, Fourier/pixel basis,\n custom loss functions etc.), and is easily extendable.\n\n.. code-block:: python\n\n import torch as ch\n from robustness.datasets import CIFAR\n from robustness.model_utils import make_and_restore_model\n\n ds = CIFAR('/path/to/cifar')\n model, _ = make_and_restore_model(arch='resnet50', dataset=ds, \n resume_path='/path/to/model', state_dict_path='model')\n model.eval()\n attack_kwargs = {\n 'constraint': 'inf', # L-inf PGD \n 'eps': 0.05, # Epsilon constraint (L-inf norm)\n 'step_size': 0.01, # Learning rate for PGD\n 'iterations': 100, # Number of PGD steps\n 'targeted': True # Targeted attack\n 'custom_loss': None # Use default cross-entropy loss\n }\n\n _, test_loader = ds.make_loaders(workers=0, batch_size=10)\n im, label = next(iter(test_loader))\n target_label = (label + ch.randint_like(label, high=9)) % 10\n adv_out, adv_im = model(im, target_label, make_adv, **attack_kwargs)\n\n- Importing ``robustness`` as a package, which allows for easy training of\n neural networks with support for custom loss functions, logging, data loading,\n and more! A good introduction can be found in our two-part walkthrough\n (`Part 1 `_, \n `Part 2 `_).\n\n.. code-block:: python\n\n from robustness import model_utils, datasets, train, defaults\n from robustness.datasets import CIFAR\n\n # We use cox (http://github.com/MadryLab/cox) to log, store and analyze \n # results. Read more at https//cox.readthedocs.io.\n from cox.utils import Parameters\n import cox.store\n\n # Hard-coded dataset, architecture, batch size, workers\n ds = CIFAR('/path/to/cifar')\n m, _ = model_utils.make_and_restore_model(arch='resnet50', dataset=ds)\n train_loader, val_loader = ds.make_loaders(batch_size=128, workers=8)\n\n # Create a cox store for logging\n out_store = cox.store.Store(OUT_DIR)\n\n # Hard-coded base parameters\n train_kwargs = {\n 'out_dir': \"train_out\",\n 'adv_train': 1,\n 'constraint': '2',\n 'eps': 0.5,\n 'attack_lr': 1.5,\n 'attack_steps': 20\n }\n train_args = Parameters(train_kwargs)\n\n # Fill whatever parameters are missing from the defaults\n train_args = defaults.check_and_fill_args(train_args,\n defaults.TRAINING_ARGS, CIFAR)\n train_args = defaults.check_and_fill_args(train_args,\n defaults.PGD_ARGS, CIFAR)\n\n # Train a model\n train.train_model(train_args, m, (train_loader, val_loader), store=out_store)\n\nCitation\n--------\nIf you use this library in your research, cite it as\nfollows:\n\n.. code-block:: bibtex\n\n @misc{robustness,\n title={Robustness (Python Library)},\n author={Logan Engstrom and Andrew Ilyas and Shibani Santurkar and Dimitris Tsipras},\n year={2019},\n url={https://github.com/MadryLab/robustness}\n }\n\n*(Have you used the package and found it useful? Let us know!)*.\n\nContributors\n-------------\n- `Andrew Ilyas `_\n- `Logan Engstrom `_\n- `Shibani Santurkar `_\n- `Dimitris Tsipras `_\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "logging tools madrylab", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "robustness", "package_url": "https://pypi.org/project/robustness/", "platform": "", "project_url": "https://pypi.org/project/robustness/", "project_urls": null, "release_url": "https://pypi.org/project/robustness/1.0.post1/", "requires_dist": [ "tqdm", "grpcio", "psutil", "gitpython", "py3nvml" ], "requires_python": "", "summary": "Tools for Robustness", "version": "1.0.post1" }, "last_serial": 5711087, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "3d5359f066a3c63a1ea963ae42d69b18", "sha256": "08706856574c8167a3520d481f1228cafd4848a9c0e469499f7573b0f7422969" }, "downloads": -1, "filename": "robustness-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3d5359f066a3c63a1ea963ae42d69b18", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 67245, "upload_time": "2019-08-21T10:06:46", "url": "https://files.pythonhosted.org/packages/68/ca/3d83745f8d7b797f5f9b1832a26ceb2b45701b68a24f6418d1e7b100d95a/robustness-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70c909a301b392ef7bca6a14318a47e8", "sha256": "ffc1cf68bfe3bed267eeb085a8b6142a983a8516c1191ece5cf7d3609de3f387" }, "downloads": -1, "filename": "robustness-1.0.tar.gz", "has_sig": false, "md5_digest": "70c909a301b392ef7bca6a14318a47e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57307, "upload_time": "2019-08-21T10:06:49", "url": "https://files.pythonhosted.org/packages/e3/ca/9f1a8756161a47b2d8982a2dcf81fb4f83ebfa8e4de86e69f3edac3a28d7/robustness-1.0.tar.gz" } ], "1.0.post1": [ { "comment_text": "", "digests": { "md5": "461392605dd6c96d054549372d83ec9e", "sha256": "38c834b4d5b13e023df7262d590e073c6c83725af3d1e2fd30491fcdca3bd4d4" }, "downloads": -1, "filename": "robustness-1.0.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "461392605dd6c96d054549372d83ec9e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 67541, "upload_time": "2019-08-21T18:25:25", "url": "https://files.pythonhosted.org/packages/01/31/c9b45a4f6ac909c39e6b01dedbd648258693a3b4d54968838e64a6ca5366/robustness-1.0.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21bf6865e82dfef9a3d3d8c4dead9347", "sha256": "b09d0b692fbc3850d4d49103ae9ccc7b9e8c03a421a798ea50de51f17e56f3c3" }, "downloads": -1, "filename": "robustness-1.0.post1.tar.gz", "has_sig": false, "md5_digest": "21bf6865e82dfef9a3d3d8c4dead9347", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57566, "upload_time": "2019-08-21T18:25:27", "url": "https://files.pythonhosted.org/packages/f5/a5/7565532da7baad8da02d370a0113509ce8bb88ae5916a0e5d7de64ae7279/robustness-1.0.post1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "461392605dd6c96d054549372d83ec9e", "sha256": "38c834b4d5b13e023df7262d590e073c6c83725af3d1e2fd30491fcdca3bd4d4" }, "downloads": -1, "filename": "robustness-1.0.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "461392605dd6c96d054549372d83ec9e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 67541, "upload_time": "2019-08-21T18:25:25", "url": "https://files.pythonhosted.org/packages/01/31/c9b45a4f6ac909c39e6b01dedbd648258693a3b4d54968838e64a6ca5366/robustness-1.0.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21bf6865e82dfef9a3d3d8c4dead9347", "sha256": "b09d0b692fbc3850d4d49103ae9ccc7b9e8c03a421a798ea50de51f17e56f3c3" }, "downloads": -1, "filename": "robustness-1.0.post1.tar.gz", "has_sig": false, "md5_digest": "21bf6865e82dfef9a3d3d8c4dead9347", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57566, "upload_time": "2019-08-21T18:25:27", "url": "https://files.pythonhosted.org/packages/f5/a5/7565532da7baad8da02d370a0113509ce8bb88ae5916a0e5d7de64ae7279/robustness-1.0.post1.tar.gz" } ] }