Skip to content

Commit

Permalink
Merge pull request #225 from HyperGAN/develop
Browse files Browse the repository at this point in the history
0.10.1
  • Loading branch information
mikkel committed Jul 28, 2019
2 parents a260206 + 748bb2f commit 0c68bd7
Show file tree
Hide file tree
Showing 35 changed files with 165 additions and 74 deletions.
8 changes: 4 additions & 4 deletions README.md
@@ -1,14 +1,14 @@
# HyperGAN 0.10.0-alpha1
# HyperGAN 0.10

[![CircleCI](https://circleci.com/gh/HyperGAN/HyperGAN.svg?style=svg)](https://circleci.com/gh/HyperGAN/HyperGAN)
[![Discord](https://img.shields.io/badge/discord-join%20chat-brightgreen.svg)](https://discord.gg/t4WWBPF)
[![Twitter](https://img.shields.io/badge/twitter-follow-blue.svg)](https://twitter.com/hypergan)

A composable GAN API and CLI. Built for developers, researchers, and artists.

0.10.0 is now available in pip. Installation instructions and support are available in our [discord](https://discord.gg/t4WWBPF)
0.10 is now available in pip. Installation instructions and support are available in our [discord](https://discord.gg/t4WWBPF)

HyperGAN is currently in open beta.
HyperGAN is in open beta.

![Colorizer 0.9 1](https://s3.amazonaws.com/hypergan-apidocs/0.9.0-images/colorizer-2.gif)

Expand Down Expand Up @@ -73,7 +73,7 @@ See the [![Discord](https://img.shields.io/badge/discord-join%20chat-brightgreen

* [Model author JSON reference](json.md)
* [Model author tutorial 1](tutorial1.md)
* [0.10.0](https://s3.amazonaws.com/hypergan-apidocs/0.10.0/index.html)
* [0.10.x](https://s3.amazonaws.com/hypergan-apidocs/0.10.0/index.html)
* [0.9.x](https://s3.amazonaws.com/hypergan-apidocs/0.9.0/index.html)
* [Test coverage](https://s3.amazonaws.com/hypergan-apidocs/0.10.0/coverage/index.html)

Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/aligan.json
Expand Up @@ -147,7 +147,7 @@
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 8 -c aligan --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler debug -b 8"
},
"hypergan_version": "0.10.0",

Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/aligan2.json
Expand Up @@ -182,7 +182,7 @@
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 8 -c aligan2 --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler debug -b 8"
},
"hypergan_version": "0.10.0",

Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/autoencode.json
Expand Up @@ -137,7 +137,7 @@
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 8 -c autoencode --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler debug -b 8"
},
"hypergan_version": "0.10.0",

Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/autoencode2.json
Expand Up @@ -163,7 +163,7 @@
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 8 -c autoencode2 --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler debug -b 8"
},
"hypergan_version": "0.10.0",
"fixed_input": true,
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/c1024small.json
Expand Up @@ -120,7 +120,7 @@
"channels": 3,
"width": 1024,
"height": 1024,
"train": "python3 hypergan/examples/colorizer.py train [dataset] --sample_every 100 --format jpg --size 1024x1024x3 -b 4 -c c1024 --save_every 5000 -z 1"
"train": "python3 [hypergan]/examples/colorizer.py train [dataset] -b 4"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/classification-configurable.json
Expand Up @@ -82,7 +82,7 @@

},
"runtime": {
"train": "python3 examples/classification.py train . -c classification-configurable -b 8 --sample_every 500 --steps 100000"
"train": "python3 [hypergan]/examples/classification.py train . -b 8"
},
"hypergan_version": "0.10.0",

Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/classification.json
Expand Up @@ -48,7 +48,7 @@
}
},
"runtime": {
"train": "python3 examples/classification.py train . -c classification -b 8 --sample_every 500 --steps 100000"
"train": "python3 [hypergan]/examples/classification.py train . -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/colorizer-resizeconv.json
Expand Up @@ -105,10 +105,10 @@
]
},
"runtime": {
"channels": 3,
"width": 256,
"height": 256,
"train": "python3 hypergan/examples/colorizer.py train [dataset] --sample_every 100 --format jpg --size 256x256x3 -b 4 -c colorizer-resizeconv --save_every 5000 -z 1"
"channels": 3,
"width": 256,
"height": 256,
"train": "python3 [hypergan]/examples/colorizer.py train [dataset] -b 4"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/colorizer.json
Expand Up @@ -118,10 +118,10 @@
},

"runtime": {
"channels": 3,
"width": 256,
"height": 256,
"train": "python3 hypergan/examples/colorizer.py train [dataset] --sample_every 100 --format jpg --size 256x256x3 -b 4 -c colorizer --save_every 5000 -z 1"
"channels": 3,
"width": 256,
"height": 256,
"train": "python3 [hypergan]/examples/colorizer.py train [dataset] --size 256x256x3 -b 4"
},
"hypergan_version": "0.10.0",
"fixed_input": true,
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/configurable-256x256.json
Expand Up @@ -88,10 +88,10 @@
}
},
"runtime": {
"channels": 3,
"width": 256,
"height": 256,
"train": "python3 hypergan/examples/colorizer.py train [dataset] --sample_every 100 --format jpg --size 256x256x3 -b 4 -c configurable-256x256 --save_every 5000 -z 1"
"channels": 3,
"width": 256,
"height": 256,
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/custom-adabound.json
Expand Up @@ -111,10 +111,10 @@
},

"runtime": {
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 1 -c stylegan --save_every 10000 --resize"
"channels": 3,
"width": 256,
"height": 256,
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"fixed_input": true,
"hypergan_version": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan-configurable.json
Expand Up @@ -87,7 +87,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-configurable --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},

"hypergan_version": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan-curl.json
Expand Up @@ -61,7 +61,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-curl --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan-ewc.json
Expand Up @@ -75,7 +75,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-ewc --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},

"hypergan_version": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan-giga.json
Expand Up @@ -69,7 +69,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-giga --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},

"hypergan_version": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan-localnash.json
Expand Up @@ -61,7 +61,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-localnash --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},

"hypergan_version": "0.10.0",
Expand Down
2 changes: 1 addition & 1 deletion hypergan/configurations/dcgan.json
Expand Up @@ -77,7 +77,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 -c dcgan-giga --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},

"hypergan_version": "0.10.0",
Expand Down
3 changes: 2 additions & 1 deletion hypergan/configurations/default.json
Expand Up @@ -97,7 +97,8 @@
}
},
"runtime": {
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 64x64x3 -b 1 --resize"
"anysize": true,
"train": "hypergan train [dataset] --sampler static_batch -b 8 --size 64x64x3"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
10 changes: 5 additions & 5 deletions hypergan/configurations/dfgan.json
Expand Up @@ -131,12 +131,12 @@
}
},
"runtime": {
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 1 -c dfgan --save_every 10000 --resize"
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"fixed_input": true,
"class": "class:hypergan.gans.noisy_gan.NoisyGAN"
"class": "class:hypergan.gans.distribution_filtering_gan.DistributionFilteringGAN"
}
2 changes: 1 addition & 1 deletion hypergan/configurations/gang.json
Expand Up @@ -121,7 +121,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler gang --format jpg --size 64x64x3 -b 1 -c gang --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/l2nn_fitness.json
Expand Up @@ -124,10 +124,10 @@
},

"runtime": {
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler debug --format jpg --size 128x128x3 -b 1 -c l2nn_fitness --save_every 10000 --resize"
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"fixed_input": true,
Expand Down
8 changes: 4 additions & 4 deletions hypergan/configurations/match_support.json
Expand Up @@ -116,10 +116,10 @@
}
},
"runtime": {
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sample_every 100 --sampler static_batch --format jpg --size 128x128x3 -b 8 -c match_support --save_every 10000 --resize"
"channels": 3,
"width": 128,
"height": 128,
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"fixed_input": true,
Expand Down
10 changes: 5 additions & 5 deletions hypergan/configurations/progress-compress.json
Expand Up @@ -41,13 +41,13 @@
"reshape -1 name=w",
"const 4*4*128",
"adaptive_instance_norm",
"resize_conv 64 avg_pool=1",
"subpixel 64 avg_pool=1",
"adaptive_instance_norm",
"resize_conv 32 avg_pool=1",
"subpixel 32 avg_pool=1",
"adaptive_instance_norm",
"resize_conv 16",
"subpixel 16",
"adaptive_instance_norm",
"resize_conv 3 avg_pool=1 activation=null"
"subpixel 3 avg_pool=1 activation=null"
]

},
Expand Down Expand Up @@ -183,7 +183,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler gang --format jpg --size 64x64x3 -b 1 -c progress-compress --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down
89 changes: 89 additions & 0 deletions hypergan/configurations/run_all.py
@@ -0,0 +1,89 @@
# An example of how to run all the configuration files in the current directory, in parallel.
# Usage: python3 run_all.py

import logging
import random
import threading
import time
import queue
import glob
import os
import json

logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
class Trainer(object):
def __init__(self, card=0):
self.lock = threading.Lock()
self.card = card
self.steps = 100000
#number_samples = 60*25 # one minute video
number_samples = 10*25 # ten second video
self.sample_every = self.steps//number_samples
self.format = 'jpg'
self.dataset = "/ml/datasets/faces/128x128_sketched/all"
self.batch_size = 8
def run(self, json_file):
obj = json.loads(open(json_file+".json", 'r').read())
if "width" in obj["runtime"]:
size = " --size "+str(obj["runtime"]["width"])+"x"+ str(obj["runtime"]["height"])+"x"+str(obj["runtime"]["channels"])
else:
print("NULL SIZE", obj)
size = ""
command = obj["runtime"]["train"]

logging.debug('Run %s on card %d', json_file, self.card)
if os.path.exists("samples/"+json_file):
logging.info('Skipping '+json_file+', samples exist')
else:
command = ("CUDA_VISIBLE_DEVICES=%d " % self.card) + command
command = command.replace("[dataset]", self.dataset)
command = command.replace("[hypergan]", "/ml/dev/hypergan/")
command += " --sample_every %d -b %d --format %s -c %s --save_every %d --steps %d --save_samples --resize" % (self.sample_every, self.batch_size, self.format, json_file, self.steps-1, self.steps)
command += size
logging.debug(command)
os.system(command)

def worker(c):
thread = threading.currentThread()
if queue.empty():
return
json_file = queue.get()
config = json_file.replace(".json","")
c.run(config)
worker(c)
queue.task_done()
logging.debug('Done')


gpus = []
gpu_count = 2
gpu_offset = 0
per_gpu = 2
queue = queue.Queue()


files = glob.glob("*.json")

for f in files:
queue.put(f)

for j in range(per_gpu):
for i in range(gpu_count):
gpu = Trainer(i+gpu_offset)

t=threading.Thread(target=worker, args=(gpu,))
gpus.append(t)
t.start()

logging.debug('Waiting for worker threads')
main_thread = threading.currentThread()

queue.join()

for t in threading.enumerate():
if t is not main_thread:
t.join()

logging.debug("Goodbye")
2 changes: 1 addition & 1 deletion hypergan/configurations/self-supervised.json
Expand Up @@ -110,7 +110,7 @@
"channels": 3,
"width": 64,
"height": 64,
"train": "hypergan train [dataset] --sample_every 100 --sampler gang --format jpg --size 64x64x3 -b 1 -c self-supervised --save_every 10000 --resize"
"train": "hypergan train [dataset] --sampler static_batch -b 8"
},
"hypergan_version": "0.10.0",
"class": "class:hypergan.gans.standard_gan.StandardGAN"
Expand Down

0 comments on commit 0c68bd7

Please sign in to comment.