def build_model(hparams): tf.reset_default_graph() if hparams.model == 'fm': model = fm.Model(hparams) elif hparams.model == 'ffm': model = ffm.Model(hparams) elif hparams.model == 'nffm': model = nffm.Model(hparams) elif hparams.model == 'xdeepfm': model = xdeepfm.Model(hparams) elif hparams.model == 'deepFM': model = deepFM.Model(hparams) elif hparams.model == 'DCN': model = DCN.Model(hparams) elif hparams.model == 'AFM': model = AFM.Model(hparams) config_proto = tf.ConfigProto(log_device_placement=0, allow_soft_placement=0) config_proto.gpu_options.allow_growth = True sess = tf.Session(config=config_proto) sess.run(tf.global_variables_initializer()) model.set_Session(sess) return model
def build_model(hparams): tf.reset_default_graph() if hparams.model == 'fm': model = fm.Model(hparams) elif hparams.model == 'ffm': model = ffm.Model(hparams) elif hparams.model == 'nffm': model = nffm.Model(hparams) elif hparams.model == 'xdeepfm': model = xdeepfm.Model(hparams) config_proto = tf.ConfigProto(log_device_placement=0, allow_soft_placement=0) config_proto.gpu_options.allow_growth = True sess = tf.Session(config=config_proto) sess.run(tf.global_variables_initializer()) # writer = tf.summary.FileWriter("D://DeepLearning//Tensorflow//ctrNet-tool-master//graph-1",sess.graph) # writer.close() model.set_Session(sess) return model