StyleGAN — Running on EC2

There’s been a bit of buzz about NVIDIA Research Projects StyleGAN — somewhat owing to the development of and Real or Fake? (disclosure: my project) .StyleGAN can be used to create images of human faces — faces of people that do not actually exist. You can read the StyleGAN paper here.

The steps below will get you up and running the first example in the recently released StyleGAN code.

  1. Launch a GPU instance (e.g. p2.xlarge) with a Deep Learning Base AMI (Amazon Linux) Version 16.2 (ami-003c401895188b246)
  2. Setup a virtual environment with Python 3.6.3 — this gist is helpful
  3. Get a copy of the StyleGAN code:
> git clone

4. Add a requirements.txt file to the stylegandirectory with the following:


5. Install the requirements into your python virtual environment:

pip install -r requirements.txt

6. In /usr/local change the cudasymlink to point to cuda-10.0:

> cd /usr/local
> sudo rm cuda
> sudo ln -s /usr/local/cuda-10.0 cuda

7. From the stylegan directory (and in your python virtual environment), run the example code:

> python

8. Examine the image file in the stylegan/results directory.

1. The above will also work when using an Ubuntu based DL AMI. Setting up a virtual environment will be slightly different.
2. Using a different version of tensorflow may require a differnt Cuda lib. Adjust as necessary.