forked from mcmillco/funcom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
24 lines (20 loc) · 918 Bytes
/
model.py
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 keras.models import Model
from keras.layers import Input, Dense, Embedding, Reshape, GRU, merge, LSTM, Dropout, BatchNormalization, Activation, concatenate, multiply, MaxPooling1D, Conv1D, Flatten
from keras.backend import tile, repeat, repeat_elements, squeeze, transpose
from keras.optimizers import RMSprop
import keras
import tensorflow as tf
from models.attendgru import AttentionGRUModel
from models.ast_attendgru_xtra import AstAttentionGRUModel as xtra
def create_model(modeltype, config):
mdl = None
if modeltype == 'attendgru':
# base attention GRU model based on Nematus architecture
mdl = AttentionGRUModel(config)
elif modeltype == 'ast-attendgru':
# attention GRU model with added AST information from srcml.
mdl = xtra(config)
else:
print("{} is not a valid model type".format(modeltype))
exit(1)
return mdl.create_model()