Skip to content

Instantly share code, notes, and snippets.

@jmbjr
Last active July 26, 2021 08:29
Show Gist options
  • Save jmbjr/291ea9767cc8e33517dc03d242e25356 to your computer and use it in GitHub Desktop.
Save jmbjr/291ea9767cc8e33517dc03d242e25356 to your computer and use it in GitHub Desktop.
quickstart guide on setting up a conda environment to run hypergan

tips on setting up a custom environment for hypergan

This guide requires Anaconda. Download and install Anaconda3 from:
https://www.anaconda.com/download/

Before you start anything with HyperGAN, you must install the CUDA libraries. If you don't have a CUDA GPU, I wouldn't recommend reading this guide further since this guide assumes you will be using a CUDA powered GPU.

Get cudnn here: https://developer.nvidia.com/cudnn

you will need to register an account to download and install. You should install version 9.0 since that's what HyperGAN and Tensorflow are looking for.

Now you need to set up a conda env. This will help isolate your HyperGAN install from the rest of your system, which should limit the potential headaches you might run into. open up an anaconda prompt (in win10 I use the search bar)

create a new env for hypergan and activate it

$ conda update conda
$ conda create -n hypergan python=3.6 anaconda #hypergan requires tensorflow which requires 3.6 currently.
$ activate hypergan

Before we go too far, you need to ensure your conda env can see your cudnn install. you can test this with:

$ where nvcc

you should get something like:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe  

if you don't get this, or if you get a version other than v9.0, you will have a bad day trying to get HyperGAN to work.
I don't have a lot of troubleshooting for this, so please let me know if anyone runs into this and you find a solution.

#Now you need to install hypergan dependencies

$ pip install tensorflow-gpu hyperchamber nashpy pygame natsort opencv-python

#create a local hypergan repo (I use git-bash to do this)

$ cd $path_to_hypergan_folder
$ git clone https://github.com/HyperGAN/HyperGAN.git

#install for develop mode inside your activated conda environment

$ cd HyperGAN
$ python setup.py develop

#At this point you need a dataset to train. I used the Faces_easy set from http://www.vision.caltech.edu/Image_Datasets/Caltech101/ #Download the dataset and extract the folder in a location of your choice and cd to the containing folder in your activated conda prompt.

$ cd $dir_with_dataset_folder

#Run hypergan in training mode. if your samples aren't 64x64, you will need to add the --resize flag #the following command uses the wgan-gp config

$ hypergan train [dataset]  --sample_every 10 --sampler static_batch --format jpg --size 64x64x3 -b 8 -c wgan-gp --save_every 5000 --resize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment