Skip to content

Commit 01615d9

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Configure setup and Travis; also remove Cleverhans from config
1 parent 47e042a commit 01615d9

File tree

5 files changed

+120
-28
lines changed

5 files changed

+120
-28
lines changed

.travis.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
sudo: required
2+
dist: trusty
3+
language: python
4+
python:
5+
- "2.7"
6+
- "3.5"
7+
matrix:
8+
include:
9+
- python: 2.7
10+
env:
11+
- KERAS_BACKEND=tensorflow
12+
- TENSORFLOW_V=1.4.1
13+
- python: 2.7
14+
env:
15+
- KERAS_BACKEND=tensorflow
16+
- TENSORFLOW_V=1.1.0
17+
- python: 3.5
18+
env:
19+
- KERAS_BACKEND=tensorflow
20+
- TENSORFLOW_V=1.1.0
21+
- python: 3.5
22+
env:
23+
- KERAS_BACKEND=tensorflow
24+
- TENSORFLOW_V=1.4.1
25+
26+
before_install:
27+
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
28+
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
29+
else
30+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
31+
fi
32+
- bash miniconda.sh -b -p $HOME/miniconda
33+
- export PATH="$HOME/miniconda/bin:$PATH"
34+
- hash -r
35+
- conda config --set always_yes yes --set changeps1 no
36+
- conda update -q conda
37+
- conda info -a
38+
39+
install:
40+
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib pandas h5py
41+
- source activate test-environment
42+
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
43+
- source activate test-environment
44+
# Install TensorFlow
45+
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" && "$TENSORFLOW_V" == "1.4.1" ]]; then
46+
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp27-none-linux_x86_64.whl;
47+
elif [[ "$TRAVIS_PYTHON_VERSION" == "2.7" && "$TENSORFLOW_V" == "1.1.0" ]]; then
48+
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp27-none-linux_x86_64.whl;
49+
elif [[ "$TRAVIS_PYTHON_VERSION" == "3.5" && "$TENSORFLOW_V" == "1.4.1" ]]; then
50+
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp35-cp35m-linux_x86_64.whl;
51+
elif [[ "$TRAVIS_PYTHON_VERSION" == "3.5" && "$TENSORFLOW_V" == "1.1.0" ]]; then
52+
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp35-cp35m-linux_x86_64.whl;
53+
fi
54+
- pip install keras
55+
# Run setup
56+
- conda install libgcc
57+
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/travis/miniconda/envs/test-environment/lib
58+
59+
script:
60+
- mkdir ./data
61+
- python -m unittest discover src/ -p '*_unittest.py'

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,47 @@ Nemesis contains implementations of the following attacks:
1212
* Universal Perturbation ([Moosavi-Dezfooli et al., 2016](https://arxiv.org/abs/1610.08401))
1313
* Virtual Adversarial Method ([Moosavi-Dezfooli et al., 2015](https://arxiv.org/abs/1507.00677))
1414
* C&W Attack ([Carlini and Wagner, 2016](https://arxiv.org/abs/1608.04644))
15+
* NewtonFool ([Jang et al., 2017](http://doi.acm.org/10.1145/3134600.3134635))
1516

1617
The following defense methods are also supported:
1718
* Feature squeezing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
19+
* Spatial smoothing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
1820
* Label smoothing (Warde-Farley and Goodfellow, 2016)
1921
* Adversarial training ([Szegedy et al., 2013](http://arxiv.org/abs/1312.6199))
2022
* Virtual adversarial training ([Miyato et al., 2017](https://arxiv.org/abs/1704.03976))
2123

2224
## Setup
2325

24-
### Requirements
25-
2626
Nemesis is designed to run with Python 3 (and most likely Python 2 with small changes). You can either download the source code of Nemesis or clone the repository in your directory of choice:
2727
```bash
2828
git clone https://github.ibm.com/Maria-Irina-Nicolae/nemesis
2929
```
3030

3131
To install the project dependencies, use the requirements file:
3232
```bash
33-
pip install -r requirements.txt
33+
pip install .
3434
```
3535

36-
You will additionally need to download [Cleverhans](https://github.com/tensorflow/cleverhans).
37-
38-
### Installation
36+
The library comes with a basic set of unit tests. To check your install, you can run all the unit tests by calling in the Nemesis folder:
37+
```bash
38+
bash run_tests.sh
39+
```
3940

40-
Nemesis is linked against Cleverhans through the configuration file `config/config.ini`. When installing Nemesis on your local machine, you need to set the appropriate paths and the `LOCAL` configuration profile as follows:
41+
The configuration file `config/config.ini` allows to set custom paths for data. By default, data is downloaded in the `nemesis/data` folder as follows:
4142

4243
```text
4344
[DEFAULT]
4445
profile=LOCAL
4546
4647
[LOCAL]
47-
data_path=/local/path/here
48-
mnist_path=/local/path/here
49-
cifar10_path=/local/path/here
50-
stl10_path=/local/path/here
51-
cleverhans_path=/local/path/here
48+
data_path=./data
49+
mnist_path=./data/mnist
50+
cifar10_path=./data/cifar-10
51+
stl10_path=./data/stl-10
5252
```
5353

5454
If the datasets are not present at the indicated path, loading them will also download the data.
5555

56-
The library comes with a basic set of unit tests. To check that the installation has succeeded, you can run all the unit tests by calling in the Nemesis folder:
57-
```bash
58-
bash run_tests.sh
59-
```
6056

6157
## Running Nemesis
6258

config/config.ini

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
[DEFAULT]
2-
profile=CLUSTER
2+
profile=LOCAL
33

44
[LOCAL]
5-
data_path=/local/path/here
6-
mnist_path=/local/path/here
7-
cifar10_path=/local/path/here
8-
stl10_path=/local/path/here
9-
imagenet_path=/local/path/here
10-
cleverhans_path=/local/path/here
5+
data_path=./data
6+
mnist_path=./data/mnist
7+
cifar10_path=./data/cifar-10
8+
stl10_path=./data/stl-10
9+
imagenet_path=./data/imagenet
1110

1211
[CLUSTER]
1312
data_path=/dccstor/dlw/data/adversarial_learning
1413
mnist_path=/dccstor/dlw/data/adversarial_learning/mnist
1514
cifar10_path=/dccstor/dlw/data/adversarial_learning/cifar-10
1615
stl10_path=/dccstor/dlw/data/adversarial_learning/stl-10
1716
imagenet_path=/dccstor/dlw/data/kg_completion/images/jpegs_ILSVRC/n02119789
18-
cleverhans_path=/u/nicolae/cleverhans

requirements.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Keras==2.0.4
2-
matplotlib==2.0.1
3-
scipy==0.19.0
4-
tensorflow==1.1.0
1+
h5py
2+
Keras
3+
matplotlib
4+
scipy
5+
tensorflow

setup.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from setuptools import setup
2+
from setuptools import find_packages
3+
4+
5+
setup(name='Adversarial Robustness Toolbox',
6+
version='0.1',
7+
description='IBM Adversarial machine learning toolbox',
8+
author='Irina Nicolae',
9+
author_email='[email protected]',
10+
url='https://github.com/ririnicolae/adversarial-robustness-toolbox',
11+
license='MIT',
12+
install_requires=['h5py',
13+
'Keras',
14+
'scipy',
15+
'matplotlib',
16+
'tensorflow',
17+
'setuptools'],
18+
# extras_require={
19+
# 'tests': ['pytest',
20+
# 'pytest-pep8',
21+
# 'pytest-xdist',
22+
# 'pytest-cov'],
23+
# },
24+
classifiers=[
25+
'Development Status :: 3 - Alpha',
26+
'Intended Audience :: Developers',
27+
'Intended Audience :: Education',
28+
'Intended Audience :: Science/Research',
29+
'License :: OSI Approved :: MIT License',
30+
'Programming Language :: Python :: 2',
31+
'Programming Language :: Python :: 3',
32+
'Topic :: Software Development :: Libraries',
33+
'Topic :: Software Development :: Libraries :: Python Modules',
34+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
35+
],
36+
packages=find_packages())

0 commit comments

Comments
 (0)