-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtensorflow_keras_model_export_pb.py
44 lines (32 loc) · 1.66 KB
/
tensorflow_keras_model_export_pb.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import sys
def main():
current_dir = os.path.dirname(__file__)
sys.path.append(os.path.join(current_dir, '..'))
current_dir = current_dir if current_dir is not '' else '.'
from keras_sentiment_analysis.library.cnn_lstm import WordVecCnnLstm
from keras_sentiment_analysis.library.cnn import WordVecCnn
from keras_sentiment_analysis.library.cnn import WordVecMultiChannelCnn
from keras_sentiment_analysis.library.lstm import WordVecLstmSoftmax
from keras_sentiment_analysis.library.lstm import WordVecLstmSigmoid
from keras_sentiment_analysis.library.lstm import WordVecBidirectionalLstmSoftmax
classifier = WordVecCnnLstm()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
classifier = WordVecCnn()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
classifier = WordVecMultiChannelCnn()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
classifier = WordVecBidirectionalLstmSoftmax()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
classifier = WordVecLstmSoftmax()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
classifier = WordVecLstmSigmoid()
classifier.load_model(current_dir + '/models')
classifier.export_tensorflow_model(output_fld=current_dir + '/models/tf')
if __name__ == '__main__':
main()