From ae6f8b68c5690e0f7dfbf26d47ceaad1257f3d9c Mon Sep 17 00:00:00 2001 From: Maciej Pesko Date: Sun, 18 Nov 2018 22:54:49 +0000 Subject: [PATCH] Add 2 workers at the same time --- ComixGAN/model.py | 2 +- entrypoint.sh | 2 +- neural_image_assessment/model.py | 2 +- style_transfer/style_transfer.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ComixGAN/model.py b/ComixGAN/model.py index ec3439f..738528e 100644 --- a/ComixGAN/model.py +++ b/ComixGAN/model.py @@ -13,7 +13,7 @@ class ComixGAN: raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), settings.COMIX_GAN_MODEL_PATH) self.graph = tf.Graph() config = tf.ConfigProto() - config.gpu_options.per_process_gpu_memory_fraction = 0.6 + config.gpu_options.per_process_gpu_memory_fraction = 0.30 config.gpu_options.allow_growth = True self.session = tf.Session(graph=self.graph, config=config) with self.graph.as_default(): diff --git a/entrypoint.sh b/entrypoint.sh index fbe4e5d..3c59d83 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh start (){ - gunicorn --bind :8008 settings.wsgi:application --timeout 300 + gunicorn --bind :8008 settings.wsgi:application --timeout 300 --workers 2 } migrate (){ diff --git a/neural_image_assessment/model.py b/neural_image_assessment/model.py index 18731cd..44e1b0f 100644 --- a/neural_image_assessment/model.py +++ b/neural_image_assessment/model.py @@ -16,7 +16,7 @@ class NeuralImageAssessment: raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), settings.NIMA_MODEL_PATH) self.graph = tf.Graph() config = tf.ConfigProto() - config.gpu_options.per_process_gpu_memory_fraction = 0.6 + config.gpu_options.per_process_gpu_memory_fraction = 0.2 config.gpu_options.allow_growth = True self.session = tf.Session(graph=self.graph, config=config) with self.graph.as_default(): diff --git a/style_transfer/style_transfer.py b/style_transfer/style_transfer.py index d116dfe..fc201f1 100644 --- a/style_transfer/style_transfer.py +++ b/style_transfer/style_transfer.py @@ -51,7 +51,7 @@ class StyleTransfer(): with comixGAN.graph.as_default(): with comixGAN.session.as_default(): - batch_size = 4 + batch_size = 2 stylized_imgs = [] for i in range(0, len(frames), batch_size): batch_of_frames = ((np.stack(frames[i:i + batch_size]) / 255) * 2) - 1