mirror of
https://github.com/deepfakes/faceswap
synced 2025-06-08 20:13:52 -04:00
Adding allow_growth option (#140)
This commit is contained in:
parent
0085b5b8a7
commit
51f1993d93
1 changed files with 16 additions and 0 deletions
|
@ -79,6 +79,11 @@ class TrainingProcessor(object):
|
||||||
type=int,
|
type=int,
|
||||||
default=64,
|
default=64,
|
||||||
help="Batch size, as a power of 2 (64, 128, 256, etc)")
|
help="Batch size, as a power of 2 (64, 128, 256, etc)")
|
||||||
|
parser.add_argument('-ag', '--allow-growth',
|
||||||
|
action="store_true",
|
||||||
|
dest="allow_growth",
|
||||||
|
default=False,
|
||||||
|
help="Sets allow_growth option of Tensorflow to spare memory on some configs")
|
||||||
parser.add_argument('-ep', '--epochs',
|
parser.add_argument('-ep', '--epochs',
|
||||||
type=int,
|
type=int,
|
||||||
default=1000000,
|
default=1000000,
|
||||||
|
@ -122,6 +127,9 @@ class TrainingProcessor(object):
|
||||||
thr.join() # waits until thread finishes
|
thr.join() # waits until thread finishes
|
||||||
|
|
||||||
def processThread(self):
|
def processThread(self):
|
||||||
|
if self.arguments.allow_growth:
|
||||||
|
self.set_tf_allow_growth()
|
||||||
|
|
||||||
print('Loading data, this may take a while...')
|
print('Loading data, this may take a while...')
|
||||||
# this is so that you can enter case insensitive values for trainer
|
# this is so that you can enter case insensitive values for trainer
|
||||||
trainer = self.arguments.trainer
|
trainer = self.arguments.trainer
|
||||||
|
@ -164,6 +172,14 @@ class TrainingProcessor(object):
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
def set_tf_allow_growth(self):
|
||||||
|
import tensorflow as tf
|
||||||
|
from keras.backend.tensorflow_backend import set_session
|
||||||
|
config = tf.ConfigProto()
|
||||||
|
config.gpu_options.allow_growth = True
|
||||||
|
config.gpu_options.visible_device_list="0"
|
||||||
|
set_session(tf.Session(config=config))
|
||||||
|
|
||||||
preview_buffer = {}
|
preview_buffer = {}
|
||||||
|
|
||||||
def show(self, image, name=''):
|
def show(self, image, name=''):
|
||||||
|
|
Loading…
Add table
Reference in a new issue