forked from guoday/ctrNet-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctrNet.py
More file actions
24 lines (23 loc) · 772 Bytes
/
ctrNet.py
File metadata and controls
24 lines (23 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from src import misc_utils as utils
from models import fm
from models import ffm
from models import nffm
from models import xdeepfm
import tensorflow as tf
from imp import reload
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())
model.set_Session(sess)
return model