StyleGAN — Running on EC2
There’s been a bit of buzz about NVIDIA Research Projects StyleGAN — somewhat owing to the development of thispersondoesnotexist.com 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.
- Launch a GPU instance (e.g. p2.xlarge) with a Deep Learning Base AMI (Amazon Linux) Version 16.2 (ami-003c401895188b246)
- Setup a virtual environment with Python 3.6.3 — this gist is helpful
- Get a copy of the StyleGAN code:
> git clone https://github.com/NVlabs/stylegan.git
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
/usr/local change the
cudasymlink to point to
> 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 pretrained_example.py
8. Examine the image file in the
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.