Shlomi Hod*, Stephen Casper*, Daniel Filan*, Cody Wild, Andrew Critch, Stuart Russell
A link to the paper will be provided as soon as it is available on arXiv. Check again in a couple of days.
Useful: Lifecycle of Docker Container
Clone the repository and change to the devops
directory.
docker build -t humancompatibleai/nn-clustering .
In other words, if you run this commands on, for example, svm
- you don't need to do so again. You're supposed then to have a container there already.
First, you need a port number to your Jupyter Netbook - pick up a random number (with your favoriate generator) in the range 8000-8500. We pick up a random number so you don't collide with existing notebooks on that machine.
First run:
- Remove the comments before, and
- Replace
<PORT NUMBER>
with your random port number (also in the instructions that will come later)
docker run \
-it \
-p <PORT NUMBER>:8888 \
--rm \
--name nn_clustering-$(whoami) \
--runtime=nvidia \ # REMOVE, if you don't have GPU
--mount type=bind,source=/scratch,target=/scratch \ # REMOVE, if not on perceptron or svm machines
humancompatibleai/nn-clustering:latest \
bash
And then type
bash build.sh
NB: to leave the container, use ctrl-P ctrl-Q. Typing exit
will destroy the container.
docker exec \
-it nn_clustering-$(whoami) \
bash
Requirements: Python 3.7 (not tested with earlier versions)
The environment is set up in a Python virtual environment. To do so:
-
Clone this repository
-
Install
graphviz
- Ubuntu/Debian:
apt intall graphviz
- MacOS:
brew install graphviz
- Ubuntu/Debian:
-
Install with
pipenv install --dev
-
On MacOS only, you will need to install
pygraphviz
separatly:pipenv run pip install pygraphviz --install-option="--include-path=/usr/local/Cellar/
-
To set up the dependencies and finish, type
cd nn_clustering
and./build.sh
-
Install packages with
pipenv install --system
. Additionally, post-hoc install:pipenv install image-classifiers==1.0.0 tensorflow-datasets
This requires the Imagenet2012 validation dataset. You will need to register at http://www.image-net.org/download-images and obtain a link to download the dataset. Then execute the following.
mkdir datasets
mkdir datasets/imagenet2012
cd datasets/imagenet2012
wget [YOUR LINK HERE]
That's all! When running experiments with imagenet models, tfrecords will be created automatically from the .tar
file.
See shells/prepare_all.sh
for commands to make datasets, train networks, cluster, and perform experiments. We use make
with a Makefile
to streamline running things. But rather than simply running shells/prepare_all.sh
, you may wish to only parts of it. It may take a long time.