|
|
@ -20,7 +20,9 @@ EMBEDDED IN CODE :
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
import tensorflow as tf
|
|
|
|
import tensorflow as tf
|
|
|
|
from tensorflow.contrib.layers import l2_regularizer
|
|
|
|
# from tensorflow.contrib.layers import l2_regularizer
|
|
|
|
|
|
|
|
from tensorflow.keras import layers
|
|
|
|
|
|
|
|
from tensorflow.keras.regularizers import L2 as l2_regularizer
|
|
|
|
import numpy as np
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
import pandas as pd
|
|
|
|
import time
|
|
|
|
import time
|
|
|
@ -34,7 +36,7 @@ import pickle
|
|
|
|
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
|
|
|
|
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
|
|
|
|
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
|
|
|
|
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
|
|
|
|
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
|
|
|
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
|
|
|
|
|
|
|
tf.compat.v1.disable_eager_execution()
|
|
|
|
# STEPS_PER_EPOCH = int(SYS_ARGS['epoch']) if 'epoch' in SYS_ARGS else 256
|
|
|
|
# STEPS_PER_EPOCH = int(SYS_ARGS['epoch']) if 'epoch' in SYS_ARGS else 256
|
|
|
|
# NUM_GPUS = 1 if 'num_gpu' not in SYS_ARGS else int(SYS_ARGS['num_gpu'])
|
|
|
|
# NUM_GPUS = 1 if 'num_gpu' not in SYS_ARGS else int(SYS_ARGS['num_gpu'])
|
|
|
|
# BATCHSIZE_PER_GPU = 2000
|
|
|
|
# BATCHSIZE_PER_GPU = 2000
|
|
|
@ -211,13 +213,14 @@ class GNet :
|
|
|
|
labels = None if 'labels' not in args else args['labels']
|
|
|
|
labels = None if 'labels' not in args else args['labels']
|
|
|
|
n_labels= None if 'n_labels' not in args else args['n_labels']
|
|
|
|
n_labels= None if 'n_labels' not in args else args['n_labels']
|
|
|
|
shift = [0] if self.__class__.__name__.lower() == 'generator' else [1] #-- not sure what this is doing
|
|
|
|
shift = [0] if self.__class__.__name__.lower() == 'generator' else [1] #-- not sure what this is doing
|
|
|
|
mean, var = tf.nn.moments(inputs, shift, keep_dims=True)
|
|
|
|
# mean, var = tf.nn.moments(inputs, shift, keep_dims=True)
|
|
|
|
shape = inputs.shape[1].value
|
|
|
|
mean, var = tf.nn.moments(inputs, shift,keepdims=True)
|
|
|
|
|
|
|
|
# shape = inputs.shape[1].value
|
|
|
|
|
|
|
|
shape = inputs.shape[1]
|
|
|
|
|
|
|
|
|
|
|
|
if labels is not None:
|
|
|
|
if labels is not None:
|
|
|
|
offset_m = self.get.variables(shape=[1,shape], name='offset'+name,
|
|
|
|
offset_m = self.get.variables(shape=[1,shape], name='offset'+name,initializer=tf.zeros_initializer)
|
|
|
|
initializer=tf.zeros_initializer)
|
|
|
|
scale_m = self.get.variables(shape=[n_labels,shape], name='scale'+name,initializer=tf.ones_initializer)
|
|
|
|
scale_m = self.get.variables(shape=[n_labels,shape], name='scale'+name,
|
|
|
|
|
|
|
|
initializer=tf.ones_initializer)
|
|
|
|
|
|
|
|
offset = tf.nn.embedding_lookup(offset_m, labels)
|
|
|
|
offset = tf.nn.embedding_lookup(offset_m, labels)
|
|
|
|
scale = tf.nn.embedding_lookup(scale_m, labels)
|
|
|
|
scale = tf.nn.embedding_lookup(scale_m, labels)
|
|
|
|
|
|
|
|
|
|
|
@ -595,7 +598,7 @@ class Predict(GNet):
|
|
|
|
df = pd.DataFrame()
|
|
|
|
df = pd.DataFrame()
|
|
|
|
CANDIDATE_COUNT = args['candidates'] if 'candidates' in args else 1 #0 if self.ROW_COUNT < 1000 else 100
|
|
|
|
CANDIDATE_COUNT = args['candidates'] if 'candidates' in args else 1 #0 if self.ROW_COUNT < 1000 else 100
|
|
|
|
candidates = []
|
|
|
|
candidates = []
|
|
|
|
|
|
|
|
|
|
|
|
with tf.compat.v1.Session() as sess:
|
|
|
|
with tf.compat.v1.Session() as sess:
|
|
|
|
saver.restore(sess, model_dir)
|
|
|
|
saver.restore(sess, model_dir)
|
|
|
|
if self._LABEL is not None :
|
|
|
|
if self._LABEL is not None :
|
|
|
|