-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelcode.py
More file actions
24 lines (16 loc) · 760 Bytes
/
modelcode.py
File metadata and controls
24 lines (16 loc) · 760 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 keras.models import Sequential
from keras.layers import LSTM, Dropout, TimeDistributed, Dense, Activation, Embedding
from keras.callbacks import ModelCheckpoint
from keras.utils import *
def make_model(num_unique_chars):
model = Sequential()
model.add(Embedding(input_dim = num_unique_chars, output_dim = 512, batch_input_shape = (1, 1)))
model.add(LSTM(256, return_sequences = True, stateful = True))
model.add(Dropout(0.2))
model.add(LSTM(256, return_sequences = True, stateful = True))
model.add(Dropout(0.2))
model.add(LSTM(256,return_sequences=True, stateful = True))
model.add(Dropout(0.2))
model.add((Dense(num_unique_chars)))
model.add(Activation("softmax"))
return model